从我的角度来看,您应该具有用于构建和发布的特定作业,并且应该手动触发发布作业。无论如何,如果出于某种原因让他们参加工作,则可以检查上一次提交的消息:
node { git 'https...' sh 'git log -1 > GIT_LOG' git_log = readFile 'GIT_LOG' if (git_log.contains('[maven-release-plugin]')) { currentBuild.result = 'ABORTED' return } ... // continue with release or whatever}


