背景:项目增量发布,使用jenkins+svn自动发布
1.配置jenkins
2.配置代码
node {
try {
stage(‘代码拉取‘) {
input id: ‘ncpprd‘, message: ‘发布生产请找-admin--批准?‘, ok: ‘确认‘, submitter: ‘admin,xiongxinjiang,haojianhui‘
sh "rm -rf /var/lib/jenkins/jobs/mmt-prd-crm/workspace/*"
checkout([$class: ‘SubversionSCM‘, additionalCredentials: [], excludedCommitMessages: ‘‘, excludedRegions: ‘‘, excludedRevprop: ‘‘, excludedUsers: ‘‘, filterChangelog: false, ignoreDirPropChanges: false, includedRegions: ‘‘, locations: [[cancelProcessOnExternalsFail: true, credentialsId: ‘xiongxinjiangsvn‘, depthOption: ‘infinity‘, ignoreExternalsOption: true, local: ‘.‘, remote: ‘https://10.10.20.165/svn/OperationSupport/CRM/documents/02系统设计/增量流程/消费金融+买买提系统/未上线/${BranchName}‘]], quietOperation: true, workspaceUpdater: [$class: ‘UpdateUpdater‘]])
}
stage(‘重启部署‘){
if ("${MODULE}".contains(‘crm53‘)){
sh "rsync -rlgoDuvzP -e ‘ssh -p 10022‘ --exclude ‘.svn‘ $WORKSPACE/platform/* [email protected]:/home/weblogic/sftp/platform/"
sh "ssh -p 10022 [email protected] -C ‘sh -x /bq/shell/deploy_crm53.sh‘"
}
if ("${MODULE}".contains(‘crm55‘)){
sh "rsync -rlgoDuvzP -e ‘ssh -p 10022‘ --exclude ‘.svn‘ $WORKSPACE/platform/* [email protected]:/home/weblogic/sftp/platform/"
sh "ssh -p 10022 [email protected] -C ‘sh -x /bq/shell/deploy_crm55.sh‘"
}
}
}catch (any) {
currentBuild.result = ‘FAILURE‘
throw any}
}
原文地址:https://blog.51cto.com/whitehat/2399386
时间: 2024-10-10 01:13:34