I have git monorepo repository with multiple projects inside. So I have following structure of Jenkinsfiles in this repo:
|-Jenkinsfile (root one)
|-projectA
| |-Jenkinsfile (for projectA)
| |- ... (project files)
|-projectB
|-Jenkinsfile (for projectB)
|- ... (project files)
In main root Jenkinsfile I have logic to check PR changed files and then trigger projects pipelines when files in specific project were changed.
And I have Webhook.
My problem is that all those 3 pipelines are triggered by Webhook. So my current state is:
- I change something in projectA and create PR
- Webhook triggers all pipeliens: root, projectA and projectB
- root pipeline notices that changes were made on projectA and triggers projectA pipeline
So in runs I have:
- one run of root pipeline triggered by webhook
- one run of projectA pipeline triggered by webhook
- one run of projectB pipeline triggered by webhook
- one run of projectA pipeline triggered by upstream
And I want to have:
- one run of root pipeline triggered by webhook
- one run of projectA pipeline triggered by upstream
I cannot change webhook nature because it's monorepo so its sent every time anyone does anything in any project. So I need to prevent projectA and projectB pipelines from reacting on incoming webhook.
Does anyone know how to do it?