Hello,
I would like to ask you for your help.
I am trying to declare this workflow:
- user has to choose param - dev, test, prod
- when use dev - copy deploy-01.txt
- when use test - copy deploy-02.txt
- when use prodution - user has to write password - when it is correct then
- copy both files.
My problem is that when I choose dev, or test, then input from prod is
still active (is shown). I just want the message to be shown only if prod
is chose in the step 1.
Thank you.
Vladimir
pipeline{
agent any
parameters {
choice choices: ['dev', 'testers', 'prod'], description: 'Select to which
deploy-to', name: 'deploy-to'
}
stages{
stage('Clean WS'){
steps{
cleanWs deleteDirs: true, patterns: [[pattern: '**/*.hg/**', type: 'EXCLUDE'
]]
}
}
stage('when'){
stages{
stage('Copy Archive - build-01') {
when {
environment ignoreCase: true, name: 'deploy-to', value: 'dev'
beforeAgent true
}
steps {
script {
step ([$class: 'CopyArtifact',
projectName: 'build-01',
filter: "*.*",
target: 'build-01']);
}
}
}
stage('Copy Archive - build-02') {
when {
environment ignoreCase: true, name: 'deploy-to', value: 'test'
beforeAgent true
}
steps {
script {
step ([$class: 'CopyArtifact',
projectName: 'build-02',
filter: "*.*",
target: 'build-02']);
}
}
}
}
}
stage('Production'){
stages{
stage('Copy Archive - build-01 and build-02') {
when {
environment ignoreCase: true, name: 'deploy-to', value: 'prod'
beforeAgent true
}
input {
message 'Are you sure that you would like to deploy to production?'
id 'ProdDeployment'
ok 'Are you sure'
submitter 'any'
parameters {
password defaultValue: 'No', description: 'Password to production', name:
'Password-to-production'
}
}
steps {
// here I will check the Password-to-production
script {
step ([$class: 'CopyArtifact',
projectName: 'build-01',
filter: "*.*",
target: 'build-01']);
}
script {
step ([$class: 'CopyArtifact',
projectName: 'build-02',
filter: "*.*",
target: 'build-02']);
}
}
}
}
}
}
post{
always{
archiveArtifacts '**/*.txt'
}
}
}
--
You received this message because you are subscribed to the Google Groups
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jenkinsci-users/1df0cab7-d817-4e0f-b185-bbfc42b0673a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.