File tree 2 files changed +46
-0
lines changed
2 files changed +46
-0
lines changed Original file line number Diff line number Diff line change 1
1
pipeline {
2
2
agent any
3
+ environment{
4
+ NEW_VERSION = ' 1.3.3'
5
+ }
3
6
4
7
stages {
5
8
stage(' Build' ) {
6
9
steps {
7
10
echo ' Building..'
11
+ echo ' Building stage'
8
12
}
9
13
}
10
14
stage(' Test' ) {
15
+ when{
16
+ expression {
17
+ BRANCH_NAME = dev || BRANCH_NAME = master
18
+ }
19
+ }
20
+ // Below code only execute when branch is DEV or master
11
21
steps {
12
22
echo ' Testing..'
23
+ echo ' Testing stage'
13
24
}
14
25
}
15
26
stage(' Deploy' ) {
16
27
steps {
17
28
echo ' Deploying....'
29
+ echo " Deploying with version ${ NEW_VERSION} "
18
30
}
19
31
}
20
32
}
33
+ // Defining post conditions
34
+ post {
35
+ always{
36
+ // sending email to team in every condition like fail success
37
+ }
38
+ success{
39
+ // Only when success
40
+ }
41
+ failure{
42
+ // Onlyu when failure
43
+ }
44
+ }
21
45
}
22
46
Original file line number Diff line number Diff line change 1
1
pipeline {
2
2
agent any
3
+ environment{
4
+ NEW_VERSION = ' 1.3.3'
5
+ }
3
6
4
7
stages {
5
8
stage(' Build' ) {
@@ -9,6 +12,12 @@ pipeline {
9
12
}
10
13
}
11
14
stage(' Test' ) {
15
+ when{
16
+ expression {
17
+ BRANCH_NAME = dev || BRANCH_NAME = master
18
+ }
19
+ }
20
+ // Below code only execute when branch is DEV or master
12
21
steps {
13
22
echo ' Testing..'
14
23
echo ' Testing stage'
@@ -17,8 +26,21 @@ pipeline {
17
26
stage(' Deploy' ) {
18
27
steps {
19
28
echo ' Deploying....'
29
+ echo " Deploying with version ${ NEW_VERSION} "
20
30
}
21
31
}
22
32
}
33
+ // Defining post conditions
34
+ post {
35
+ always{
36
+ // sending email to team in every condition like fail success
37
+ }
38
+ success{
39
+ // Only when success
40
+ }
41
+ failure{
42
+ // Onlyu when failure
43
+ }
44
+ }
23
45
}
24
46
You can’t perform that action at this time.
0 commit comments