我想选择 Groovy 脚本中的所有选项,因此它默认为全部。我正在使用“主动选择反应参数”,因为我正在阅读上一个选项。如何制作我的“输出”变量,以便在用户不选择它们的情况下全部选择它们?
def output = []
def line
def release = RELEASE_NUMBER
releaseNumber = release.replaceAll("\\n", "");
String[] number = releaseNumber.split("\\.");
def list = "cmd /c e:\\tools\\wget --no-check-certificate --http-user=username--http-password=password-qO- \"https://1.1.1.1:443/svn/Instructions/trunk/${number[0]}.${number[1]}.${number[2]}/ICAN/EI_${releaseNumber}.txt\"".execute().text
list.eachLine {
if (it.contains("- LH")) {
String newName = it.replaceAll("\\s", "");
String newName2 = newName.replaceAll("-", "");
output.add(newName2)
}
}
return output
Run Code Online (Sandbox Code Playgroud) 我有一个名为ENVIRONMENT的Active Choice参数.我想在下一个Active Choice Parameter中使用该参数.如何检索先前的选择?
这是我的代码.我无法弄清楚如何从上一个参数中检索环境变量,并将其分配给我的第二个变量的新groovy脚本中的env变量.
import groovy.sql.Sql
String env = $ENVIRONMENT
def output = []
def db = [url:'jdbc:oracle:thin:@database_host:1521:SID', user:'username', password:'password', driver:'oracle.jdbc.OracleDriver']
def sql = Sql.newInstance(db.url, db.user, db.password, db.driver)
String sqlString = ("select distinct logical_host from SERVER_NAME_VW where app='ME' and env = ${env} order by 1")
sql.eachRow(sqlString){ row ->
output.push(row[0])
}
return output
Run Code Online (Sandbox Code Playgroud)