Merge "Report to Checks when the build starts" into stable-2.16
This commit is contained in:
15
Jenkinsfile
vendored
15
Jenkinsfile
vendored
@@ -54,7 +54,10 @@ class GerritCheck {
|
|||||||
}
|
}
|
||||||
|
|
||||||
def getCheckResultFromBuild() {
|
def getCheckResultFromBuild() {
|
||||||
def resultString = build.result.toString()
|
if (!build.getResult()) {
|
||||||
|
return "RUNNING"
|
||||||
|
}
|
||||||
|
def resultString = build.getResult().toString()
|
||||||
if (resultString == 'SUCCESS') {
|
if (resultString == 'SUCCESS') {
|
||||||
return "SUCCESSFUL"
|
return "SUCCESSFUL"
|
||||||
} else if (resultString == 'NOT_BUILT' || resultString == 'ABORTED') {
|
} else if (resultString == 'NOT_BUILT' || resultString == 'ABORTED') {
|
||||||
@@ -108,6 +111,9 @@ def prepareBuildsForMode(buildName, mode="reviewdb", retryTimes = 1) {
|
|||||||
def slaveBuild = null
|
def slaveBuild = null
|
||||||
for (int i = 1; i <= retryTimes; i++) {
|
for (int i = 1; i <= retryTimes; i++) {
|
||||||
try {
|
try {
|
||||||
|
postCheck(new GerritCheck(
|
||||||
|
(buildName == "Gerrit-codestyle") ? "codestyle" : mode,
|
||||||
|
new Build(currentBuild.getAbsoluteUrl(), null)))
|
||||||
slaveBuild = build job: "${buildName}", parameters: [
|
slaveBuild = build job: "${buildName}", parameters: [
|
||||||
string(name: 'REFSPEC', value: "refs/changes/${env.BRANCH_NAME}"),
|
string(name: 'REFSPEC', value: "refs/changes/${env.BRANCH_NAME}"),
|
||||||
string(name: 'BRANCH', value: env.GERRIT_PATCHSET_REVISION),
|
string(name: 'BRANCH', value: env.GERRIT_PATCHSET_REVISION),
|
||||||
@@ -119,9 +125,11 @@ def prepareBuildsForMode(buildName, mode="reviewdb", retryTimes = 1) {
|
|||||||
if (buildName == "Gerrit-codestyle"){
|
if (buildName == "Gerrit-codestyle"){
|
||||||
Builds.codeStyle = new Build(
|
Builds.codeStyle = new Build(
|
||||||
slaveBuild.getAbsoluteUrl(), slaveBuild.getResult())
|
slaveBuild.getAbsoluteUrl(), slaveBuild.getResult())
|
||||||
|
postCheck(new GerritCheck("codestyle", Builds.codeStyle))
|
||||||
} else {
|
} else {
|
||||||
Builds.verification[mode] = new Build(
|
Builds.verification[mode] = new Build(
|
||||||
slaveBuild.getAbsoluteUrl(), slaveBuild.getResult())
|
slaveBuild.getAbsoluteUrl(), slaveBuild.getResult())
|
||||||
|
postCheck(new GerritCheck(mode, Builds.verification[mode]))
|
||||||
}
|
}
|
||||||
if (slaveBuild.getResult() == "SUCCESS") {
|
if (slaveBuild.getResult() == "SUCCESS") {
|
||||||
break
|
break
|
||||||
@@ -235,7 +243,6 @@ node ('master') {
|
|||||||
stage('Report to Gerrit'){
|
stage('Report to Gerrit'){
|
||||||
resCodeStyle = getLabelValue(1, Builds.codeStyle.result)
|
resCodeStyle = getLabelValue(1, Builds.codeStyle.result)
|
||||||
gerritReview labels: ['Code-Style': resCodeStyle]
|
gerritReview labels: ['Code-Style': resCodeStyle]
|
||||||
postCheck(new GerritCheck("codestyle", Builds.codeStyle))
|
|
||||||
|
|
||||||
def verificationResults = Builds.verification.collect { k, v -> v }
|
def verificationResults = Builds.verification.collect { k, v -> v }
|
||||||
def resVerify = verificationResults.inject(1) {
|
def resVerify = verificationResults.inject(1) {
|
||||||
@@ -243,10 +250,6 @@ node ('master') {
|
|||||||
}
|
}
|
||||||
gerritReview labels: ['Verified': resVerify]
|
gerritReview labels: ['Verified': resVerify]
|
||||||
|
|
||||||
Builds.verification.each { type, build -> postCheck(
|
|
||||||
new GerritCheck(type, build)
|
|
||||||
)}
|
|
||||||
|
|
||||||
setResult(resVerify, resCodeStyle)
|
setResult(resVerify, resCodeStyle)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user