您好,登錄后才能下訂單哦!
node('slave-191') { stage('從SVN拉取代碼') { checkout([$class: 'SubversionSCM', additionalCredentials: [], excludedCommitMessages: '', excludedRegions: '', excludedRevprop: '', excludedUsers: '', filterChangelog: false, ignoreDirPropChanges: false, includedRegions: '', locations: [[cancelProcessOnExternalsFail: true, credentialsId: '用戶名和密碼ID', depthOption: 'infinity', ignoreExternalsOption: true, local: '.', remote: 'svn項目鏈接']], 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打包') { sh '''export Node_Home=/usr/local/node-v12.13.1 export PATH="$PATH:$Node_Home/bin" $Node_Home/bin/npm run build''' } stage("更改API接口地址") { sh '''sed -i 's/ip1/ip2/g' ${WORKSPACE}/dist/static/config.js ''' } stage("打包dist并歸檔") { sh '''tar -zcvf dist.tar.gz dist/ ''' archiveArtifacts artifacts: '*.tar.gz', fingerprint: true } stage('部署包') { sh ''' cp -r ${WORKSPACE}/dist/ /usr/local/nginx/html/ ''' } stage('測試服務啟動') { 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.構建結果
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。