pipeline {
agent any
stages {
stage('清理工作区') {
steps {
cleanWs()
}
}
stage('拉取代码') {
steps {
script {
git branch: "${GIT_BRANCH}", credentialsId: 'liuq', url: 'https://gitlab.123.com/modo-cloud/modo-cloud-access.git'
}
}
}
stage('构建') {
steps {
script {
sh "mvn clean package -Dmaven.test.skip=true -P angeltest -U"
}
}
}
stage('上传文件') {
steps {
script {
stash(name: 'file', includes: '**/modo-cloud-access-web/target/modo-cloud-access-web-1.0.0-SNAPSHOT-assembly.tar.gz')
}
}
}
stage('复制文件到angeltest节点') {
agent { label 'angeltest' }
steps {
script {
unstash('file')
}
}
}
stage('生成版本号') {
agent { label 'master' }
steps {
script {
env.DOCKER_IMAGE_VERSION = "${versionNumber(projectStartDate: '2024-11-29', versionNumberString: '1.0', versionPrefix: 'aliyuncs.com/angelgroup/dmp-modo-base-access', worstResultForIncrement: 'SUCCESS')}.${new Date().format('yyyyMMdd')}"
echo "生成 docker 镜像版本: ${env.DOCKER_IMAGE_VERSION}"
}
}
}
}
}
Do I need to label the controller node
In newer Jenkins versions the controller has the label built-in
. But you can also manually add the master
label so old jobs and pipelines still work.