How to get Jenkins variable with Groovy Script

22 views
Skip to first unread message

J.P. Hochbaum

unread,
Dec 21, 2016, 11:37:35 AM12/21/16
to Jenkins Users
I have three drop down boxes and I want the first drop down variable to determine what is in the second drop down.  My algo below works with hard coding the first drop down variable and I get the return variable I need.  $TradingGroup is the variabale from the first drop down I am trying to populate this algo with.



def props = new Properties()

//initialize property file path//
def stream = new FileInputStream('/tmp/***')
try {
//load property file//
props.load(stream)
} finally {
//once loaded close the stream//
stream.close()
}
//get only property keys and convert into string array//
def parameters = props.keySet() as String[]
//println parameters
//def parameters=props.keySet() as String;
//parameters.each { println it }
parameters.each { def groupString = it.split(',') 
                println groupString
                 
                 groupString.each{ it.split(',')
                                  if (groupString[0] == $TradingGroup){
                                    var = it
                                    if (it!=$TradingGroup){
                                      println var
                                    return var
                                    }}
                                  }
                }
Reply all
Reply to author
Forward
0 new messages