1

I have a project based security enabled for my jobs. And based on user being admin / non-admin would like to show / hide certain build parameters.

Can anyone suggest an approach to tackle this requirements or are there any plugins for this?

Thanks!! Appreciate your help on this.

user2669295
  • 13
  • 1
  • 5

1 Answers1

1

I don't think there is such a feature directly, but there is a workaround.

  • Configure "non-admin" job with only the parameters that non-admins should see.
  • Give that job security so that non-admins can build it.
  • Configure second "admin" job
  • Give that second job security so that only admins can build it.

In the Job Configuration of the second "admin" job, you need to:

  • Define all parameters (admin and non-admin)
  • Use Parameterized Trigger plugin ("Trigger/call builds on other projects" build action) to trigger "non-admin" job
  • Configure Add Parameters -> Current build parameters
  • That's it.

In the Job Configuration of the first "non-admin" job, you need to:

  • Define just non-admin parameters, making sure their names are exactly same as overlapping parameters from "admin" job
  • Configure the rest of the job as you normally would.
  • All parameters, even those that are passed from the triggering "admin" job are available as environment variables (even if they are not explicitly defined in "non-admin" job)
Slav
  • 27,057
  • 11
  • 80
  • 104