Skip to content

Commit 833a7ba

Browse files
committed
Merge remote-tracking branch 'upstream/master' into branch1
2 parents 6cb2a9c + b2545e8 commit 833a7ba

File tree

1 file changed

+17
-13
lines changed

1 file changed

+17
-13
lines changed

Jenkinsfile

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,11 @@ def UNIT_RESULTS = "${TEST_RESULTS_FOLDER}/unit"
6969
*/
7070
def MASTER_BRANCH = "master"
7171

72-
7372
/**
74-
* A command to be run that gets the current revision pulled down
73+
* Variables to check any new commit since the previous successful commit
7574
*/
76-
def GIT_REVISION_LOOKUP = 'git log -n 1 --pretty=format:%h'
75+
def GIT_COMMIT = "null"
76+
def GIT_PREVIOUS_SUCCESSFUL_COMMIT = "null"
7777

7878
/**
7979
* This is the product name used by the build machine to store information about
@@ -130,8 +130,13 @@ pipeline {
130130
stage("Clean workspace and checkout source") {
131131
steps {
132132
timeout(time: 5, unit: 'MINUTES') {
133-
cleanWs()
134-
checkout scm
133+
script {
134+
cleanWs()
135+
scmInfo = checkout scm
136+
137+
GIT_COMMIT = scmInfo.GIT_COMMIT
138+
GIT_PREVIOUS_SUCCESSFUL_COMMIT = scmInfo.GIT_PREVIOUS_SUCCESSFUL_COMMIT
139+
}
135140
}
136141
}
137142
}
@@ -164,12 +169,6 @@ pipeline {
164169
steps {
165170
timeout(time: 2, unit: 'MINUTES') {
166171
script {
167-
// We need to keep track of the current commit revision. This is to prevent the condition where
168-
// the build starts on master and another branch gets merged to master prior to version bump
169-
// commit taking place. If left unhandled, the version bump could be done on latest master branch
170-
// code which would already be ahead of this build.
171-
BUILD_REVISION = sh returnStdout: true, script: GIT_REVISION_LOOKUP
172-
173172
// This checks for the [ci skip] text. If found, the status code is 0
174173
def result = sh returnStatus: true, script: 'git log -1 | grep \'.*\\[ci skip\\].*\''
175174
if (result == 0) {
@@ -542,6 +541,9 @@ pipeline {
542541
expression {
543542
return BRANCH_NAME == MASTER_BRANCH
544543
}
544+
expression {
545+
return GIT_COMMIT != GIT_PREVIOUS_SUCCESSFUL_COMMIT
546+
}
545547
}
546548
}
547549
steps {
@@ -591,7 +593,10 @@ pipeline {
591593
return PIPELINE_CONTROL.deploy
592594
}
593595
expression {
594-
return BRANCH_NAME == MASTER_BRANCH
596+
return BRANCH_NAME == MASTER_BRANCH
597+
}
598+
expression {
599+
return GIT_COMMIT != GIT_PREVIOUS_SUCCESSFUL_COMMIT
595600
}
596601
}
597602
}
@@ -622,7 +627,6 @@ pipeline {
622627
}
623628
}
624629
}
625-
626630
}
627631
post {
628632
unsuccessful {

0 commit comments

Comments
 (0)