一种解决方法,如果使用GIT:
当碰撞的版本和提交,在使用特定的消息提交日志例如:[GIT-版本凸点] - 植球的版本
SCM后签出,检查最后一次提交是否为版本缓冲提交,如果是,则中止作业。
stage('Checkout') {
checkout scm
if (lastCommitIsBumpCommit()) {
currentBuild.result = 'ABORTED'
error('Last commit bumped the version, aborting the build to prevent a loop.')
} else {
echo('Last commit is not a bump commit, job continues as normal.')
}
}
private boolean lastCommitIsBumpCommit() {
lastCommit = sh([script: 'git log -1', returnStdout: true])
if (lastCommit.contains("[git-version-bump]")) {
return true
} else {
return false
}
}
还不是一个确切的解决方案,但如果它帮助别人,我发现了两种方法可以使这项工作。首先,我可以通过将“Property strategy”更改为“命名分支获取不同属性”,然后在“Add property”下选择“Suppress automatic SCM triggering”来禁用一组分支上的自动构建。其次,我能够配置Bitbucket来抑制某些用户的推送通知。通过这样做,我可以抑制构建服务器用户的构建,这与我链接的文章所用的方法相同。但是,我不知道其他回购是否支持这一点。 – Pace