Basically, we're doing trunk development here, and got tons of services under the same directory.
I have a Jenkins job that is triggered through GitHub webhook, and that will do some actions only if there's a change in a specific directory of that repo :
pipeline {
agent any
stages {
stage('Building') {
when { changeset "subdirectory/*"}
steps {
-- do whatever is configured
}
}
stage('Deploying to Dev') {
when { changeset "subdirectory/*"}
steps {
-- do whatever is configured
}
}
}
}
That part works fine. In my other Jenkinsfile that we trigger manually, I also have this, to send a notification on Slack :
post {
success {
slackSend channel: '#my-notif-channel',
color: 'good',
message: "Yay ! "
}
failure {
slackSend channel: '#my-notif-channel',
color: 'danger',
message: "Nay !"
}
}
Issue with this is, whether there was a change or not in that directory, the notification will be sent. Is there a way to enable that block only when a change in my subdir ?