无法在詹金斯时髦中做减法



我有一个构建管道。我还在学时髦。我正在做这样简单的事情

stage('test'){
def temp = 3 \ reading this value from other env variable 
while(temp != 1) {
temp=temp-1
echo temp
}
}

它总是回响 3,而 while 是永无止境的。

当您从环境变量中读取值时,您以字符串形式获取它

您需要将其转换为整数

def temp = env.SOMETHING.toInteger()

或者,将其定义为整数,而不是使用def

int temp = env.SOMETHING

最新更新