本文讲述直接拉取已提交的Vue代码及编译后的代码到指定文件夹中去。
nginx配置
location /eladmin/{ alias /apps/statics/eladmin/dist/; autoindex off; try_files $uri $uri/ @eladminrouter; } location @eladminrouter { rewrite ^/(eladmin)/(.+)$ /$1/index.html last; # rewrite ^.*$ /index.html last; }
jenkins配置:
代码分支版本号
代码git配置:
#!/bin/bash -ilex echo ${WORKSPACE} echo ${JOB_NAME} echo ${BUILD_ID} timeStamp=`date +%Y-%m-%d` echo $timeStamp mkdir -p /thirdparties/apache-tomcat-8090/webapps/docs/build/${JOB_NAME}/$timeStamp@${BUILD_NUMBER} cd ${WORKSPACE} zip -q -r dist.zip dist mv ${WORKSPACE}/dist.zip /thirdparties/apache-tomcat-8090/webapps/docs/build/${JOB_NAME}/$timeStamp@${BUILD_NUMBER}
su - devuser -c "/apps/unpacking_eladmin-web-publish.sh ${JOB_NAME} ${BUILD_NUMBER}"
unpacking_eladmin-web-publish.sh文件代码
#!/bin/bash echo $1 $2 $3 timeStamp=`date +%Y-%m-%d` echo $timeStamp@$2 APP_NAME=dist.zip cd /apps/ if [ ! -d statics ];then mkdir statics chmod 755 statics else echo statics dir exist fi cd statics if [ ! -d eladmin ];then mkdir eladmin chmod 755 eladmin else chmod 755 eladmin echo eladmin dir exist fi rm -rf eladmin/* cd /apps/ wget http://localhost:8090/docs/build/$1/$timeStamp@$2/$APP_NAME -nH -r -N -nv cd /apps/statics/eladmin cp /apps/docs/build/$1/$timeStamp@$2/$APP_NAME . unzip dist.zip -d /apps/statics/eladmin/ rm -rf $APP_NAME