I'm trying to use Jenkins DSL with office-365-connector-plugin and restrict the notifications to master
branch only.
From looking at the UI config in Jenkins it seems like this is acheivable using Macros:
However I have no idea what to put there, moreover how can I use it in the DSL? I did see examples of people using it but I don't understand what they are acheiving (example)
Using a jenkinsfile, you could do it this way:
stage('a stage') {
when {
branch 'master'
}
steps {
office365ConnectorSend webhookUrl: 'https://outlook.office.com/webhook/d6cee...',
message: 'a message'
}
}
Or like this:
post {
failure {
script {
if (env.BRANCH_NAME == 'master') {
office365ConnectorSend webhookUrl: 'https://outlook.office.com/webhook/d6cee...',
message: 'a message'
}
}
}
}