我通过jenkins的管道建立自己的工作,并使用Snippet Generator创建我的代码:
node {
stage 'input'
input id: 'Tt', message: 'your password:', ok: 'ok', parameters: [string(defaultValue: 'mb', description: 'vbn', name: 'PARAM'), string(defaultValue: 'hj', description: 'kkkk', name: 'PARAM2')]
// here I need get the text user input , like `PARAM` or `PARAM2`
}
如上所述,get参数的语法是什么?
答案 0 :(得分:3)
我只限于测试代码,但我认为应该是这样:
node {
stage 'input'
def userPasswordInput = input(
id: 'userPasswordInput', message: 'your password', parameters: [
[$class: 'TextParameterDefinition', defaultValue='mb', description: 'vbn', name: 'password']
]
)
echo ("Password was: " + userPasswordInput)
}
答案 1 :(得分:1)
node {
stage 'input'
def userPasswordInput = input(
id: 'Password', message: 'input your password: ', ok: 'ok', parameters: [string(defaultValue: 'master', description: '.....', name: 'LIB_TEST')]
)
echo ("Password was: " + userPasswordInput)
}
根据Joschi给出的想法,上面的代码效果很好。非常感谢Joschi。