Bạn tạo 1 pipeline và sử dụng Jenkinsfile
pipeline{
agent{
label "k8s-permanent"
}
stages{
stage("Build"){
input{
message "Please specify environment"
ok "OK"
submitter "dummyuser,admin@localhost.com"
submitterParameter "whoIsSubmitter"
parameters{
string(name: "environment", defaultValue: "Dev", description: "Environment to build for (valid value: Dev, Text, Prod)")
string(name: "version", defaultValue: "1.0", description: "version number to build for")
booleanParam(name: "to_deploy_to_environment", defaultValue: true, description: "")
choice(choices: "US-EST-1\nUS-EST-2", description: "what aws region?", name: "region")
text(name: "myText", defaultValue: "myTextValue", description: "myText")
password(name: "myPassword", defaultValue: "myPasswordValue", description: "myDescription")
file(name: "myFile", description: "fileDescription")
credentials(name: "myCredentials", description: "myCredentialDesc", required: true)
}
}
steps{
echo "We are building for ${environment}, ${version}, and we are deploying to environment: ${to_deploy_to_environment}"
echo "region: ${region}, myText: ${myText}, myPassword: ${myPassword}, and myFile: ${myFile}"
echo "submitter is: ${whoIsSubmitter}"
echo "selected credentials is: ${myCredentials}"
}
}
}
}
Khi mình ấn build thì sẽ như sau: