当我将PR发送到Develop分支时如何开始Jenkins的工作,而当我合并到该分支时也如何开始。
使用以下代码,它会触发PR的两个if块 我试图使用下面的代码无法正常工作
if (env.BRANCH_NAME != 'master') { if
(env.BRANCH_NAME.toLowerCase().contains('pr')) {
try {
stage 'Checkout Code'
bogieNode {
deleteDir()
echo 'Pulling...' + env.BRANCH_NAME + env.CHANGE_ID
checkoutCode {}
project.loadProperties()
stash 'sources'
}
} catch (Exception ex) {
sendFailureNotifications(
emailCulprits: true, // emails the suspected commit culprit(s)
notifySlackChannel: 'xxxxxxx', // send notification to the team's slack channel
)
throw ex // re-throw so that the exception bubbles up to the console
} } }
if (env.BRANCH_NAME != 'master') {
try {
stage 'Checkout Code'
bogieNode {
deleteDir()
echo 'Hellllooooooooooooooo Pulling...' + env.BRANCH_NAME
checkoutCode {}
project.loadProperties()
stash 'sources'
}
} catch (Exception ex) {
sendFailureNotifications(
emailCulprits: true, // emails the suspected commit culprit(s)
notifySlackChannel: 'xxxxxx', // send notification to the team's slack channel
)
throw ex // re-throw so that the exception bubbles up to the console
}
}