从詹金斯的管道步骤获取用户输入的语法是什么?
What's the syntax of get the user's input from jenkins's pipeline step?
我通过 jenkins 管道构建我的工作,并使用代码段生成器来创建我的代码,如下所示:
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`
}
如上所述,获取参数的语法是什么?
我对代码的测试有点局限,但我认为它应该是这样的:
node {
stage 'input'
def userPasswordInput = input(
id: 'userPasswordInput', message: 'your password', parameters: [
[$class: 'TextParameterDefinition', defaultValue='mb', description: 'vbn', name: 'password']
]
)
echo ("Password was: " + userPasswordInput)
}
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。
我通过 jenkins 管道构建我的工作,并使用代码段生成器来创建我的代码,如下所示:
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`
}
如上所述,获取参数的语法是什么?
我对代码的测试有点局限,但我认为它应该是这样的:
node {
stage 'input'
def userPasswordInput = input(
id: 'userPasswordInput', message: 'your password', parameters: [
[$class: 'TextParameterDefinition', defaultValue='mb', description: 'vbn', name: 'password']
]
)
echo ("Password was: " + userPasswordInput)
}
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。