in vars/gerritPipeline.groovy [131:162]
def collectBuildModes() {
Builds.modes = []
if (env.GERRIT_BRANCH == "master" || env.GERRIT_BRANCH ==~ /stable-3.[4-5]/) {
Builds.modes = ["notedb", "rbe"]
} else if (env.GERRIT_BRANCH == "stable-3.3") {
Builds.modes = ["notedb"]
} else {
throw new Exception("Unsupported branch ${env.GERRIT_BRANCH}")
}
def changedFiles = queryChangedFiles(Globals.gerritUrl)
def isMerge = changedFiles.contains("/MERGE_LIST")
def polygerritFiles = changedFiles.findAll { it.startsWith("polygerrit-ui") ||
it.startsWith("lib/js") }
def bazelFiles = changedFiles.findAll { it == "WORKSPACE" || it.endsWith("BUILD") ||
it.endsWith(".bzl") || it == ".bazelversion" }
if(isMerge) {
println "Merge commit detected, adding 'polygerrit' validation..."
Builds.modes += "polygerrit"
} else if(polygerritFiles.size() > 0) {
if(changedFiles.size() == polygerritFiles.size() && bazelFiles.isEmpty()) {
println "Only PolyGerrit UI changes detected, skipping other test modes..."
Builds.modes = ["polygerrit"]
} else {
println "PolyGerrit UI changes detected, adding 'polygerrit' validation..."
Builds.modes += "polygerrit"
}
} else if(!bazelFiles.isEmpty()) {
println "Bazel files changes detected, adding 'polygerrit' validation..."
Builds.modes += "polygerrit"
}
}