zoukankan      html  css  js  c++  java
  • [转] 在Jenkins Pipeline DSL中 遍历 groovy list

    [From] https://stackoverflow.com/questions/36360097/iterating-a-groovy-list-in-jenkins-pipeline-dsl

    // 定义一个List,并向里面加入一些元素
    def componentList = [] def componentMapEntry1 = [:] componentMapEntry1['componentName']="Dashboard_Core" componentList << componentMapEntry1 def componentMapEntry2 = [:] componentMapEntry2['componentName']="Dashboard_Equities" componentList << componentMapEntry2 def cme3 = [:] cme3["componentName"] = "home" componentList << cme3
    echo "size of list "+componentList.size()
    
    // pipeline里打印size() [Pipeline]
    echo size of list 3
    println componentList
    
    // pipeline里直接打印list [Pipeline]
    echo [{componentName=Dashboard_Core}, {componentName=Dashboard_Equities}, {componentName=home}]
    for (i = 0; i <componentList.size(); i++) {
        println componentList[i]
    }
    
    // pipeline里遍历list
    [Pipeline] echo
    {componentName=Dashboard_Core}
    [Pipeline] echo
    {componentName=Dashboard_Equities}
    [Pipeline] echo
    {componentName=home}
  • 相关阅读:
    Linux 学习 -- 修改文件的权限(chmod)
    Spring MVC
    Spring AOP与IOC
    Java学习
    SSH学习
    Android之Service
    Android之操作相册
    Android之ListView优化
    Android之Bitmap 高效加载
    Android数据储存之SQLiteDatabase SQLiteOpenHelper类的简单使用
  • 原文地址:https://www.cnblogs.com/pekkle/p/9882993.html
Copyright © 2011-2022 走看看