Jenkins Active Choice Parameter插件

 

Active Choice plug-in会生成三种参数类型:

复制代码
    1,Active Choices Parameter(主动选择参数)
    Active Choices参数使用Groovy脚本或Scriptler目录中的脚本动态生成构建参数的值选项列表。
    2,Active Choices Reactive Parameter(主动选择反应参数)
    根据主动选择参数的选项而提供不同的对应值或者列表选项。
    3,Active Choices Reactive Reference Parameter(主动选择反应参考参数)
    根据主动选择参数的选项而展示对应参数的一些说明,与第二项的区别在于本参数只作为说明信息,而不能够作为变量往下传递。
复制代码

 


  1.  

     

    复制代码
    Development=["development-1","development-2"]
    Production=["production-1","production-2","production-3"]
    UAT=["uat-1","uat-2"]
    
    if (Environment.equals("Development")) {
        return Development
    } else if (Environment.equals("Production")) {
        return Production
    } else if (Environment.equals("UAT")) {
        return UAT
    } else {
        return ["Unknown hosts"]
    }
    复制代码

     

  2. 动态列出目录下的文件

     

     

     


  3.  

     

     

     

    复制代码
    return[
    'Sao Paulo',
    'Sao Paulo-1:selected',
    'Rio de Janeiro',
    'Rio de Janeiro-1:disabled',
    'Parana',
    'Acre'
    ]
    复制代码
    复制代码
    if (States.equals("Sao Paulo")) {
      return ["Barretos", "Sao Paulo", "Itu"]
    } else if (States.equals("Rio de Janeiro")) {
      return ["Rio de Janeiro", "Mangaratiba"]
    } else if (States.equals("Parana")) {
      return ["Curitiba", "Ponta Grossa"]
    } else if (States.equals("Acre")) {
      return ["Rio Branco", "Acrelandia"]
    } else {
      return ["Unknown state"]
    }
    复制代码
    复制代码
    switch(States){
     case~/.*Sao Paulo.*/:
        winerec='Champagne is perfect with anything salty'
        return '<img src="https://part-item-images.oss-cn-shanghai.aliyuncs.com/001/055/979.jpg">'
     break
    case ~/.*Parana.*/:
        winerec='Sauvignon Blanc goes with tart dressings and sauces'
        return "<b>${winerec}</b>"
    break
     case~/.*Acre.*/:
        winerec='Choose Grüner Veltliner when a dish has lots of fresh herbs'
        return "<b>${winerec}</b>"
     break
    case~/.*Rio de Janeiro.*/:
        winerec='Pinot Grigio pairs well with light fish dishes'
        return '<img src="https://part-item-images.oss-cn-shanghai.aliyuncs.com/001/055/910.jpg">'
     break
    case ~/.*Chardonnay.*/:
        winerec='Choose Chardonnay for fatty fish or fish in a rich sauce'
        return "<b>${winerec}</b>"
    break
     case~/.*Off-Dry Riesling.*/:
        winerec='Off-Dry Riesling pairs with sweet & spicy dishes'
        return "<b>${winerec}</b>"
     break
     case~/.*Moscato dAsti.*/:
        winerec='Moscato dAsti loves fruit desserts'
        return "<b>${winerec}</b>"
     break
    case ~/.*dry Rosé.*/:
        winerec='Pair a dry Rosé with rich, cheesy dishes'
        return "<b>${winerec}</b>"
    break
     case~/.*Pinot Noir.*/:
        winerec='Pinot Noir is great for dishes with earthy flavors'
        return "<b>${winerec}</b>"
     break
    }
    复制代码

    https://blog.csdn.net/tobealistenner/article/details/109071609

 

posted @   ascertain  阅读(6464)  评论(0编辑  收藏  举报
编辑推荐:
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
点击右上角即可分享
微信分享提示