Search code examples
jenkinsgroovyjenkins-pipeline

Hide (or hard-code) choice parameter in Jenkins


Sorry for my question, I'm new at jenkins, pipelines, groovy and other... I have a task to disable choice parameter with only one choice in my jenkins job (enter image description here But if I comment it in groovy, my build fails. These parameters (loadEnvironment) is using in mainPipeline and may be in other places in checking. I need only hide or hard-code it in my pipeline, not in main.

properties([ parameters([ choice(choices: ['Stage2_new'], description: 'loadEnviroment', name: 'loadEnvironment'),

Can you give me idea for this implementation? Thank you.

I tried to comment it - build fails


Solution

  • I decided it with comments of parameter (which I wanted to disable from UI Jenkins) in my pipeline and in main pipeline (which invokes by my pipeline). And in build of parameters I set loadEnviroment in default "stage 2" then map is empty.