Jenkins realizes the development of front-end VUE project automation packaging and release
Node ('slave-191') {stage (' pull substitution code from SVN') {checkout ([$class: 'SubversionSCM', additionalCredentials: [], excludedCommitMessages:', excludedRegions:', excludedRevprop:', excludedUsers:', filterChangelog: false, ignoreDirPropChanges: false, includedRegions:', locations: [cancelProcessOnExternalsFail: true, credentialsId: 'username and password ID', depthOption:' infinity', ignoreExternalsOption: true, local:'. Remote: 'svn Project Link'], quietOperation: true WorkspaceUpdater: [$class: 'UpdateUpdater']])} stage ("Install") {sh' 'export Node_Home=/usr/local/node-v12.13.1 export PATH= "$PATH:$Node_Home/bin" $Node_Home/bin/cnpm install'''} stage (' NPM package') {sh 'export Node_Home=/usr/local/node-v12.13.1 Export PATH= "$PATH:$Node_Home/bin" $Node_Home/bin/npm run build'''} stage ("change the API interface address") {sh''sed-I' s sed ip1 and ip2 stage ("package dist and archive") {sh 'tar-zcvf dist.tar.gz Dist/''archiveArtifacts artifacts:' * .tar.gz' Fingerprint: true} stage ('deployment package') {sh'cp-r {WORKSPACE} / dist/ / usr/local/nginx/html/''} stage ('Test Service startup') {sh 'running_num= `/ usr/bin/systemctl status nginx | grep running | wc-l` if [$running_num-eq 1] Then echo "deploy success" else echo "deploy failed" exit 1 fi''}}
4. Construction result