Skip to content

Sending custom webhook parameters to jenkins while triggering build

HI, I want to add some of my own parameters and send it along with the git lab webhook URL when I test for push events, or on merge.

I want to use these parameters in my Jenkinsfile when the pipeline is running. I have tried adding the below URL in my gitlab integration for webhook -

http://jenkins-url/jenkins/project/job-name/buildWithParameters?token=sample_token&param1=new_param&param2=new_param2

In the Jenkins job configuration I have also checked "This build is parametrized", and have added param1 and param2 and string parameters and set default values for them as p1 and p2.

But When I run the job, the default parameters are getting extracted and not the ones i pass from the webhook URL. Kindly help me out with detailed steps for this fix.