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('測試服務(wù)啟動') { 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.構(gòu)建結(jié)果
創(chuàng)新互聯(lián)是專業(yè)的槐蔭網(wǎng)站建設(shè)公司,槐蔭接單;提供成都做網(wǎng)站、網(wǎng)站制作,網(wǎng)頁設(shè)計,網(wǎng)站設(shè)計,建網(wǎng)站,PHP網(wǎng)站建設(shè)等專業(yè)做網(wǎng)站服務(wù);采用PHP框架,可快速的進(jìn)行槐蔭網(wǎng)站開發(fā)網(wǎng)頁制作和功能擴(kuò)展;專業(yè)做搜索引擎喜愛的網(wǎng)站,專業(yè)的做網(wǎng)站團(tuán)隊,希望更多企業(yè)前來合作!