piplineパイプライン配置
2005 ワード
pipline
node {
stage('checkout') {
dir('/dzzb/usr/local/newdzzb/gjzs_ht') {
//
checkout([$class: 'SubversionSCM', additionalCredentials: [], excludedCommitMessages: '', excludedRegions: '', excludedRevprop: '', excludedUsers: '', filterChangelog: false, ignoreDirPropChanges: false, includedRegions: '', locations: [[cancelProcessOnExternalsFail: true, credentialsId: '8053b42a-62f1-4fae-b646-2271f3668c45', depthOption: 'infinity', ignoreExternalsOption: true, local: '.', remote: '']], quietOperation: true, workspaceUpdater: [$class: 'UpdateUpdater']])
}
}
stage('Change Config') {
sh "yes|cp /htdocs/WEN-INF/bidding_collection_platform/* /dzzb/usr/local/newdzzb/gjzs_ht/src/main/resources/"
}
stage('Build') {
dir('/dzzb/usr/local/newdzzb/gjzs_ht') {
//
sh "mvn clean install -Dmaven.test.skip=true -U "
}
}
stage('Deploy') {
//
withEnv(['JENKINS_NODE_COOKIE=background_job']) {
sh '''
cd /dzzb/usr/local/newdzzb/gjzs_ht/target
scp bidding_collection_platform-1.0.0.jar root@ip:/htdocs/work_jar/gjzs_ht
ssh root@ip /bin/bash -x /htdocs/shell/gjzs/test.sh
'''
}
}
stage('CLean') {
//
dir('/dzzb/usr/local/newdzzb/gjzs_ht') {
//
sh "rm -rf src/ target/"
}
}
}
shell
#!/bin/bash
exportBUILD_ID=dontkillme
ps -fwwu root | grep bidding_collection_platform-1.0.0.jar |grep -v grep | grep -v PID | awk '{print $2}'|xargs kill -15
source /etc/profile
sleep 3
nohup java -jar /htdocs/work_jar/gjzs_ht/bidding_collection_platform-1.0.0.jar >> /htdocs/work_jar/gjzs_ht/test.log 2>&1 &