如何在Jenkins declarative pipeline中运行特定阶段
示例:
如果我想要run only the stage 3(Deploy Nexus artifact) without running the stage 1, 2 and 4.,我如何才能做到这一点?
发布于 2019-04-08 17:40:19
您可以将什么时候表达式与您想跳过的每个阶段一起使用。变量checkoutCode、runSonarScan、deployNexusArtifact可以静态或动态地设置为环境变量。
environment {
checkoutCode = true
runSonarScan = true
deployNexusArtifact = true
}
stage('Gitlab code Checkout') {
when { expression { "${checkoutCode}" == 'true' } }
...
}
stage('Sonarqube scan') {
when { expression { "${runSonarScan}" == 'true' } }
...
}
stage('Deploy Nexus artifact') {
when { expression { "${deployNexusArtifact}" == 'true' } }
...
}https://stackoverflow.com/questions/55577693
复制相似问题