pipline 写法分为 脚本式和声明式,下面采用脚本式编程:
node {
stage('checkout') {
echo '开始检出代码'
checkout([$class: 'GitSCM', branches: [[name: '*/master']], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[credentialsId: 'e83d9b3c-9ce8-4999-8d69-0f779f106545', url: 'git@gitlab.xx.git']]])
}
stage('copyconfig') {
echo '开始复制配置文件'
sh ''' 配置生产配置文件'''
}
stage('Build') {
echo '开始构建'
sh '/usr/local/apache-maven-3.5.3/bin/mvn clean package'
}
stage('ReadyWar'){
sh returnStatus: true, script: '''这里发布多个war,通过shell寻找war包 '''
}
stage('deploy'){
sh returnStatus: true, script: ''这里通过脚本在docker宿主编译镜像或者启动容器 '''
}
}