2

I have multibranch pipeline that is created to build and run test for every Pull Request. I would like to skip build process for commits that have certain keywords in the log

For eg: if logs are as follows for 3 commits (PR1, PR2, PR3) --

PR1 - (style) New Style added

PR2 - (docs) Updated Doc

PR3 - (test) New Test Added

Then build should be triggered only for PR3 and not for PR1 and PR2

This is because "(style)" and "(docs)" are the keywords that need to skip building process.

I tried to use the option suggested over here on SO

Particularly option of changelog. Here is how I implemented the code to skip words "(style)" and "(docs)" in the log.

stage('Deploy And Run Unit Tests') {
    when {
        not {
           changelog '.*^\\((style|docs)\\) .+$'
        }
    }
    steps {
        script { mydockerscripts.runScriptInDocker('./build_and_run_test.sh') }
    }
}

But this doesn't seem to help. Any thoughts what is wrong here in my code.

(If it is of any use our code is in bitbucket)

katch
  • 820
  • 1
  • 7
  • 24

0 Answers0