<kbd id="afajh"><form id="afajh"></form></kbd>
<strong id="afajh"><dl id="afajh"></dl></strong>
    <del id="afajh"><form id="afajh"></form></del>
        1. <th id="afajh"><progress id="afajh"></progress></th>
          <b id="afajh"><abbr id="afajh"></abbr></b>
          <th id="afajh"><progress id="afajh"></progress></th>

          使用 Active Choice Parameter 參數(shù)化構建

          共 3399字,需瀏覽 7分鐘

           ·

          2020-11-28 21:53


          在使用Pipeline項目時 一般都是參數(shù)化構建工作,在Jenkins的構建需要使用參數(shù)類型有復選框,單選按鈕,多選值等輸入的情景。

          轉到→管理Jenkins→選擇管理插件→選擇可用選項卡,然后搜索主動選擇插件。安裝并重新啟動Jenkins,以正確安裝插件。我的已經(jīng)安裝好,因此在“已安裝”標簽中列出。


          主動選擇參數(shù)
          使用Groovy腳本或Scriptler目錄中的腳本為生成參數(shù)動態(tài)生成值選項列表。參數(shù)可以動態(tài)更新,現(xiàn)為組合框,復選框,單選按鈕豐富的HTML UI窗口小部件。
          ?


          按住Ctrl 就可以多選了。



          主動選擇反應參數(shù)
          當作業(yè)中UI控件的值發(fā)生更改時,可以動態(tài)更新(主動選擇和響應參考參數(shù)) 這里可以使用IF進行條件判斷,輸出相關的值。



          項目地址:

          https://github.com/jenkinsci/active-choices-plugin


          插件地址:

          https://plugins.jenkins.io/uno-choice/




          Jenkinsfile



          properties([    parameters([        [$class: 'ChoiceParameter',             choiceType: 'PT_SINGLE_SELECT',             description: 'Select the Env Name from the Dropdown List',             filterLength: 1,             filterable: true,             name: 'Env',             randomName: 'choice-parameter-5631314439613978',             script: [                $class: 'GroovyScript',                 fallbackScript: [                    classpath: [],                     sandbox: false,                     script:                         'return[\'Could not get Env\']'                ],                 script: [                    classpath: [],                     sandbox: false,                     script:                         'return["Dev","QA","Stage","Prod"]'                ]            ]        ],         [$class: 'CascadeChoiceParameter',             choiceType: 'PT_SINGLE_SELECT',             description: 'Select the Server from the Dropdown List',             filterLength: 1,             filterable: true,             name: 'Server',             randomName: 'choice-parameter-5631314456178619',             referencedParameters: 'Env',             script: [                $class: 'GroovyScript',                 fallbackScript: [                    classpath: [],                     sandbox: false,                     script:                         'return[\'Could not get Environment from Env Param\']'                ],                 script: [                    classpath: [],                     sandbox: false,                     script:                         ''' if (Env.equals("Dev")){                                return["devaaa001","devaaa002","devbbb001","devbbb002","devccc001","devccc002"]                            }                            else if(Env.equals("QA")){                                return["qaaaa001","qabbb002","qaccc003"]                            }                            else if(Env.equals("Stage")){                                return["staaa001","stbbb002","stccc003"]                            }                            else if(Env.equals("Prod")){                                return["praaa001","prbbb002","prccc003"]                            }                        '''                ]            ]        ]    ])])
          pipeline { environment { vari = "" } agent any stages { stage ("Example") { steps { script{ echo 'Hello' echo "${params.Env}" echo "${params.Server}" if (params.Server.equals("Could not get Environment from Env Param")) { echo "Must be the first build after Pipeline deployment. Aborting the build" currentBuild.result = 'ABORTED' return } echo "Crossed param validation" } } } }}



          ?點擊屏末?|??|?即刻學習

          瀏覽 119
          點贊
          評論
          收藏
          分享

          手機掃一掃分享

          分享
          舉報
          評論
          圖片
          表情
          推薦
          點贊
          評論
          收藏
          分享

          手機掃一掃分享

          分享
          舉報
          <kbd id="afajh"><form id="afajh"></form></kbd>
          <strong id="afajh"><dl id="afajh"></dl></strong>
            <del id="afajh"><form id="afajh"></form></del>
                1. <th id="afajh"><progress id="afajh"></progress></th>
                  <b id="afajh"><abbr id="afajh"></abbr></b>
                  <th id="afajh"><progress id="afajh"></progress></th>
                  亚洲成人大香蕉视频 | 亚洲色一| 无码在线观看免费视频 | 欧美日视频 | 亲子乱伦视频 |