Skip to content

Commit 84e8d47

Browse files
author
ranjeet-pivotchain
committed
Updated Jenkinfiles
1 parent c933eab commit 84e8d47

File tree

2 files changed

+46
-0
lines changed

2 files changed

+46
-0
lines changed

Jenkinsfile

+24
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,46 @@
11
pipeline {
22
agent any
3+
environment{
4+
NEW_VERSION = '1.3.3'
5+
}
36

47
stages {
58
stage('Build') {
69
steps {
710
echo 'Building..'
11+
echo 'Building stage'
812
}
913
}
1014
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
1121
steps {
1222
echo 'Testing..'
23+
echo 'Testing stage'
1324
}
1425
}
1526
stage('Deploy') {
1627
steps {
1728
echo 'Deploying....'
29+
echo "Deploying with version ${NEW_VERSION}"
1830
}
1931
}
2032
}
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+
}
2145
}
2246

jenkinfile/Jenkinsfile

+22
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
pipeline {
22
agent any
3+
environment{
4+
NEW_VERSION = '1.3.3'
5+
}
36

47
stages {
58
stage('Build') {
@@ -9,6 +12,12 @@ pipeline {
912
}
1013
}
1114
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
1221
steps {
1322
echo 'Testing..'
1423
echo 'Testing stage'
@@ -17,8 +26,21 @@ pipeline {
1726
stage('Deploy') {
1827
steps {
1928
echo 'Deploying....'
29+
echo "Deploying with version ${NEW_VERSION}"
2030
}
2131
}
2232
}
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+
}
2345
}
2446

0 commit comments

Comments
 (0)