Bài này chúng ta có thể thấy rằng jenkins sẽ giúp chúng ta tạo form submit (simple) như ảnh bên dưới.
và mình sẽ cung cấp cho bạn script như sau:
node {
properties([
parameters([
string(
defaultValue: 'Dev',
description: 'Environment to build for (Valid values: Dev, Test, Prod)',
name: 'environment'
),
booleanParam(
defaultValue: true,
description: '',
name: 'to_deploy_to_environment'
),
choice(
choices: "HCM-1\nHCM-2",
description: 'What Nimtechnology region?',
name: 'region'
),
text(
name: "myText",
defaultValue: "myTextValue",
description: "myText"
),
password(
name: "myPassword",
description: "myPassword"
),
file(
name: "myFile",
description: "fileDescription"
),
credentials(
name: "myCredentials",
description: "myCredentialsDesc",
required: true
)
])
])
echo "We are building for ${params.environment}, and we are deploying to environment: ${params.to_deploy_to_environment}"
echo "region: ${params.region}, myText: ${params.myText}, myPassword: ${params.myPassword}, and myFile: ${params.myFile}"
echo "selected credentials is: ${params.myCredentials}"
}