1

I'm using Gerrit Trigger Plugin for Jenkins to trigger my job. I want to trigger my job ONLY IF files from folder 1 AND folder 2 are changed. However as far as my understanding is concerned, with the following configuration we can trigger the job if files from folder 1 OR folder 2 are changed. How can I get this AND condition? I'll really appreciate your help.

Click here to See Gerrit Trigger Plugin Configuration Screenshot

MOJ
  • 11
  • 3

1 Answers1

0

As a workaround, you may fetch changes on job trigger and check if changes were done in both dirs.Continue only when both condition meet. pseudo-code for groovy/pipeline:

// get changes
sh 'git diff-tree --no-commit-id --name-only -r HEAD > changes.txt'

//create list from changes,each entry is 
def file = readFile "changes.txt"
changed_files=file.split('\n')

//iterate over changed_files and check if trigger directories are present
//flag if found 
//if conditions are met,continue with build
jozefow
  • 626
  • 3
  • 14