Is there a way to pre-populate Jenkins build page for parameterized builds?

Viewed 2558

I have a Jenkins job that takes environment name as a parameter. On another site/dashboard, I would like to create links to this Jenkins job. But the link should pre-populate the parameter based on where it was clicked from.

Something like this,

<a href="https://jenkins/<someJenkinsAPI>?ENV=env1">env1</a>
<a href="https://jenkins/<someJenkinsAPI>?ENV=env2">env2</a>

Is this possible?

1 Answers

Just came across this plugin: https://plugins.jenkins.io/build-with-parameters With this, you just need to go to a URL like this: https://jenkins.mycompany.com/job/nikhil-test/parambuild/?ENV=env2&APP=myapp

This will open up the /buildWithParameters page for that job, with the values from your URL pre-populated on the page! If you don't provide a parameter OR provide an invalid value for the parameter, it will pre-populate that parameter with the default value.

build page

Related