我有jenkins管道,由非技术人员触发,技术人员将批准或拒绝此构建。 所以我的问题是,流技术人员应该更改/填写一些空的参数(非技术人员无法知道或忘记输入)。
stage 'Waiting Approval'
currentBuild.displayName = "Waiting for Approvel:" + name
timeout(time: 5, unit: 'DAYS')
{
input message: "Do you approve creating new user("+ name +")?", ok: 'Approve', submitter: 'Bilisim'
}
// ########### STEP For Checking Missing or Wrong Parameters & Correct Them !!!! ##############
node('domainController') {
stage 'Create New User'
currentBuild.displayName = "Creating AD User:"+name
build job: 'Create New AD User', parameters: [string(name: 'groups', value: groups), string(name: 'emailAdd', value: emailAdd), string(name: 'name', value: name), string(name: 'surname', value: surname), string(name: 'title', value: title), string(name: 'department', value: department), string(name: 'manager', value: manager), string(name: 'company', value: company), string(name: 'streetAdd', value: streetAdd), string(name: 'city', value: city), string(name: 'state', value: state), string(name: 'country', value: country), string(name: 'pcode', value: pcode), booleanParam(name: 'sendMail', value: sendMail.toBoolean()), booleanParam(name: 'details', value: details.toBoolean()), string(name: 'ou', value: ou)]
currentBuild.displayName = "Finished Creating User:" + name
}
答案 0 :(得分:0)
Jenkins管道参数作为变量传递给您的管道,因此您可以更新您的变量值。我不认为你真的可以改变"构建视图中的参数,但您可以等待技术人员输入并在需要时替换非技术人员参数。
示例:
stage "Stage 1"
echo "Non-technical person parameter : ${name}"
stage "Waiting approval"
timeout(time: 5, unit: 'DAYS') {
def technicalApprovedUser = input id: 'input_approved_name' message: "Do you approve creating new user("+ name +")?", ok: 'Approve', submitter: 'Bilisim', parameters: [[$class: 'StringParameterDefinition', defaultValue: "${name}", description: '', name: 'User Name']]
}
stage 'Create New User'
currentBuild.displayName = "Creating AD User:"+technicalApprovedUser
build job: 'Create New AD User', parameters: [string(name: 'groups', value: groups), string(name: 'emailAdd', value: emailAdd), string(name: 'name', value: technicalApprovedUser), string(name: 'surname', value: surname), string(name: 'title', value: title), string(name: 'department', value: department), string(name: 'manager', value: manager), string(name: 'company', value: company), string(name: 'streetAdd', value: streetAdd), string(name: 'city', value: city), string(name: 'state', value: state), string(name: 'country', value: country), string(name: 'pcode', value: pcode), booleanParam(name: 'sendMail', value: sendMail.toBoolean()), booleanParam(name: 'details', value: details.toBoolean()), string(name: 'ou', value: ou)]
currentBuild.displayName = "Finistère Creating User:" + technicalApprovedUser