0

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 ?

SBO
  • 544
  • 1
  • 5
  • 12
  • I tried the first part and that did not even work: https://github.com/hohwille/jenkins-multimodule-pipeline/issues/1 – Jörg May 16 '23 at 17:02
  • thanks for sharing. The pattern syntax requires two asterisks to also include changes in subfolders. Here is my runnable demo app with Jenkinsfile: https://github.com/hohwille/jenkins-multimodule-pipeline – Jörg May 23 '23 at 14:20

0 Answers0