How to pass custom parameters to jenkins job (multibranch pipeline) on git push? How to pass custom parameters to jenkins job (multibranch pipeline) on git push? jenkins jenkins

How to pass custom parameters to jenkins job (multibranch pipeline) on git push?


You can use your parameters in the URL.

http://server/job/myjob/buildWithParameters?token=TOKEN&PARAMETER=Value

Go through the link for more information


How about setting params based on commit message: (along the lines of)

commitMsg = sh(returnStdout: true, script: "git --no-pager show -s --format='%s' -1")

Then in your commit you can do whatever you want, like Finished feature. param1=this BOOL=true ...And in your pipeline you can parse them (not tested):

param1 = (commitMsg =~ /.*(param1=\S) .*]]>/)[ 0 ]​[ 1 ]