[jenkins] disable CI metrics for temporary feature branches (#81938)

Co-authored-by: spalger <spalger@users.noreply.github.com>
This commit is contained in:
Spencer 2020-10-28 14:08:56 -07:00 committed by GitHub
parent 526de26f03
commit 271a799ef8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 1 deletions

View file

@ -2,6 +2,7 @@ def call(branchOverride) {
def repoInfo = [
branch: branchOverride ?: env.ghprbSourceBranch,
targetBranch: env.ghprbTargetBranch,
targetsTrackedBranch: true
]
if (repoInfo.branch == null) {
@ -35,6 +36,10 @@ def call(branchOverride) {
label: "determining merge point with '${repoInfo.targetBranch}' at origin",
returnStdout: true
).trim()
def pkgJson = readFile("package.json")
def releaseBranch = toJSON(pkgJson).branch
repoInfo.targetsTrackedBranch = releaseBranch == repoInfo.targetBranch
}
print "repoInfo: ${repoInfo}"

View file

@ -149,7 +149,7 @@ def getTestFailuresMessage() {
def getBuildStatusIncludingMetrics() {
def status = buildUtils.getBuildStatus()
if (status == 'SUCCESS' && !ciStats.getMetricsSuccess()) {
if (status == 'SUCCESS' && shouldCheckCiMetricSuccess() && !ciStats.getMetricsSuccess()) {
return 'FAILURE'
}
@ -297,3 +297,12 @@ def getFailedSteps() {
step.displayName != 'Check out from version control'
}
}
def shouldCheckCiMetricSuccess() {
// disable ciMetrics success check when a PR is targetting a non-tracked branch
if (buildState.has('checkoutInfo') && !buildState.get('checkoutInfo').targetsTrackedBranch) {
return false
}
return true
}