File tree Expand file tree Collapse file tree 1 file changed +20
-4
lines changed Expand file tree Collapse file tree 1 file changed +20
-4
lines changed Original file line number Diff line number Diff line change @@ -75,6 +75,12 @@ def MASTER_BRANCH = "master"
75
75
*/
76
76
def GIT_REVISION_LOOKUP = ' git log -n 1 --pretty=format:%h'
77
77
78
+ /**
79
+ * Variables to check any new commit since the previous successful commit
80
+ */
81
+ def GIT_COMMIT = " null"
82
+ def GIT_PREVIOUS_SUCCESSFUL_COMMIT = " null"
83
+
78
84
/**
79
85
* This is the product name used by the build machine to store information about
80
86
* the builds
@@ -130,8 +136,13 @@ pipeline {
130
136
stage(" Clean workspace and checkout source" ) {
131
137
steps {
132
138
timeout(time : 5 , unit : ' MINUTES' ) {
133
- cleanWs()
134
- checkout scm
139
+ script {
140
+ cleanWs()
141
+ scmInfo = checkout scm
142
+
143
+ GIT_COMMIT = scmInfo. GIT_COMMIT
144
+ GIT_PREVIOUS_SUCCESSFUL_COMMIT = scmInfo. GIT_PREVIOUS_SUCCESSFUL_COMMIT
145
+ }
135
146
}
136
147
}
137
148
}
@@ -542,6 +553,9 @@ pipeline {
542
553
expression {
543
554
return BRANCH_NAME == MASTER_BRANCH
544
555
}
556
+ expression {
557
+ return GIT_COMMIT != GIT_PREVIOUS_SUCCESSFUL_COMMIT
558
+ }
545
559
}
546
560
}
547
561
steps {
@@ -591,7 +605,10 @@ pipeline {
591
605
return PIPELINE_CONTROL . deploy
592
606
}
593
607
expression {
594
- return BRANCH_NAME == MASTER_BRANCH
608
+ return BRANCH_NAME == MASTER_BRANCH
609
+ }
610
+ expression {
611
+ return GIT_COMMIT != GIT_PREVIOUS_SUCCESSFUL_COMMIT
595
612
}
596
613
}
597
614
}
@@ -622,7 +639,6 @@ pipeline {
622
639
}
623
640
}
624
641
}
625
-
626
642
}
627
643
post {
628
644
unsuccessful {
You can’t perform that action at this time.
0 commit comments