Как запустить работу Jenkins, когда я отправляю PR в филиал Develop, а также, когда я сливаюсь в эту ветку.
С помощью приведенного ниже кода он запускает оба блока if для PR
Я пытаюсь использовать приведенный ниже код, он не работает, как ожидалось
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
}
}