How to use Active Choices Reactive Reference Parameter in Jenkins pipeline(jenkinsfile)

前端 未结 2 2141
感动是毒
感动是毒 2021-01-24 04:22

I want achieve Picture 3. If no need update, give default value. If need update, then give user input area.

I\'d like use active reactive Reference in Jenkins pipeline

2条回答
  •  礼貌的吻别
    2021-01-24 04:57

    Thanks Markzhu;

    I ran into the same problem and this solution really helped!

    You really don't need to use a Jenkinsfile though. You can just add the code to the reactive parameter like this.

    if(NeedUpgradePC.equals('yes')) {
      inputBox=""
    } else {
      inputBox=""
    }
    

    But the better option is to stop using text and use a checkbox instead. Here is how you check the value of a checkbox.

    1. Use a standard Boolean Parameter and name it 'NeedUpgradePC'
    2. Add a description like: "Intel Core i5"
    3. In the Groovy Script for your Active Choices Reactive Reference Parameter:
    if (NeedUpgradePC.equals('on')){
      inputBox=""
    } else {
      inputBox=""
    }
    

提交回复
热议问题