Merge branch 'stable-2.16' into stable-3.0

* stable-2.16:
  Use reliable check for empty env.GERRIT_CHANGE_NUMBER
  Do not build on stable-2.14 branch

Change-Id: If60fc67b15f4b5090cbee6dd9c65f4dbe4b5fcba
This commit is contained in:
David Pursehouse
2019-12-08 11:31:52 +09:00

20
Jenkinsfile vendored
View File

@@ -88,6 +88,10 @@ class GerritCheck {
}
}
def hasChangeNumber() {
env.GERRIT_CHANGE_NUMBER?.trim()
}
def postCheck(check) {
def gerritPostUrl = Globals.gerritUrl +
"a/changes/${check.changeNum}/revisions/${check.sha1}/checks"
@@ -185,17 +189,17 @@ def prepareBuildsForMode(buildName, mode="notedb", retryTimes = 1) {
def collectBuilds() {
def builds = [:]
if (env.GERRIT_CHANGE_NUMBER == "") {
if (hasChangeNumber()) {
builds["Gerrit-codestyle"] = prepareBuildsForMode("Gerrit-codestyle")
Builds.modes.each {
builds["Gerrit-verification(${it})"] = prepareBuildsForMode("Gerrit-verifier-bazel", it)
}
} else {
builds["java8"] = { -> build "Gerrit-bazel-${env.BRANCH_NAME}" }
if (env.BRANCH_NAME == "master") {
builds["java11"] = { -> build "Gerrit-bazel-java11-${env.BRANCH_NAME}" }
}
} else {
builds["Gerrit-codestyle"] = prepareBuildsForMode("Gerrit-codestyle")
Builds.modes.each {
builds["Gerrit-verification(${it})"] = prepareBuildsForMode("Gerrit-verifier-bazel", it)
}
}
return builds
}
@@ -282,7 +286,7 @@ def createVerifyMsgBody(builds) {
node ('master') {
if (env.GERRIT_CHANGE_NUMBER != "") {
if (hasChangeNumber()) {
stage('Preparing'){
gerritReview labels: ['Verified': 0, 'Code-Style': 0]
@@ -293,7 +297,7 @@ node ('master') {
parallel(collectBuilds())
if (env.GERRIT_CHANGE_NUMBER != "") {
if (hasChangeNumber()) {
stage('Retry Flaky Builds'){
def flakyBuildsModes = findFlakyBuilds()
if (flakyBuildsModes.size() > 0){