Skip to content

Commit eb7a19b

Browse files
authored
Create parameters2
1 parent 88072d6 commit eb7a19b

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

JENKINS/parameters2

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
Here is an example of a stage that will be executed based on the condition that we get from the choice parameter.
2+
3+
The parameter name is ENVIRONMENT, and we access it in the stage as params.ENVIRONMENT.
4+
So when the choice parameter matches PROD, it will execute the steps mentioned in the stage.
5+
6+
stage('Deploy to Production') {
7+
when {
8+
expression {
9+
return params.ENVIRONMENT == 'PROD'
10+
}
11+
}
12+
steps {
13+
sh """
14+
echo "deploy to production"
15+
"""
16+
}
17+
}
18+
}

0 commit comments

Comments
 (0)