mirror of
https://github.com/elastic/kibana.git
synced 2025-06-28 11:05:39 -04:00
[CI] Add error steps and help links to PR comments (#60772)
This commit is contained in:
parent
c7b0ade01d
commit
c22dbb1764
2 changed files with 40 additions and 0 deletions
|
@ -169,7 +169,20 @@ def getNextCommentMessage(previousCommentInfo = [:]) {
|
||||||
## :broken_heart: Build Failed
|
## :broken_heart: Build Failed
|
||||||
* [continuous-integration/kibana-ci/pull-request](${env.BUILD_URL})
|
* [continuous-integration/kibana-ci/pull-request](${env.BUILD_URL})
|
||||||
* Commit: ${getCommitHash()}
|
* Commit: ${getCommitHash()}
|
||||||
|
* [Pipeline Steps](${env.BUILD_URL}flowGraphTable) (look for red circles / failed steps)
|
||||||
|
* [Interpreting CI Failures](https://www.elastic.co/guide/en/kibana/current/interpreting-ci-failures.html)
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
try {
|
||||||
|
def steps = getFailedSteps()
|
||||||
|
if (steps?.size() > 0) {
|
||||||
|
def list = steps.collect { "* [${it.displayName}](${it.logs})" }.join("\n")
|
||||||
|
messages << "### Failed CI Steps\n${list}"
|
||||||
|
}
|
||||||
|
} catch (ex) {
|
||||||
|
buildUtils.printStacktrace(ex)
|
||||||
|
print "Error retrieving failed pipeline steps for PR comment, will skip this section"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
messages << getTestFailuresMessage()
|
messages << getTestFailuresMessage()
|
||||||
|
@ -220,3 +233,9 @@ def deleteComment(commentId) {
|
||||||
def getCommitHash() {
|
def getCommitHash() {
|
||||||
return env.ghprbActualCommit
|
return env.ghprbActualCommit
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def getFailedSteps() {
|
||||||
|
return jenkinsApi.getFailedSteps()?.findAll { step ->
|
||||||
|
step.displayName != 'Check out from version control'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
21
vars/jenkinsApi.groovy
Normal file
21
vars/jenkinsApi.groovy
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
def getSteps() {
|
||||||
|
def url = "${env.BUILD_URL}api/json?tree=actions[nodes[iconColor,running,displayName,id,parents]]"
|
||||||
|
def responseRaw = httpRequest([ method: "GET", url: url ])
|
||||||
|
def response = toJSON(responseRaw)
|
||||||
|
|
||||||
|
def graphAction = response?.actions?.find { it._class == "org.jenkinsci.plugins.workflow.job.views.FlowGraphAction" }
|
||||||
|
|
||||||
|
return graphAction?.nodes
|
||||||
|
}
|
||||||
|
|
||||||
|
def getFailedSteps() {
|
||||||
|
def steps = getSteps()
|
||||||
|
def failedSteps = steps?.findAll { it.iconColor == "red" && it._class == "org.jenkinsci.plugins.workflow.cps.nodes.StepAtomNode" }
|
||||||
|
failedSteps.each { step ->
|
||||||
|
step.logs = "${env.BUILD_URL}execution/node/${step.id}/log".toString()
|
||||||
|
}
|
||||||
|
|
||||||
|
return failedSteps
|
||||||
|
}
|
||||||
|
|
||||||
|
return this
|
Loading…
Add table
Add a link
Reference in a new issue