Skip to content

Commit

Permalink
[jenkins/prs] report docs changes url in PR comments (#89454)
Browse files Browse the repository at this point in the history
Co-authored-by: spalger <spalger@users.noreply.github.com>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
  • Loading branch information
3 people authored Feb 1, 2021
1 parent 4380c49 commit 3f96892
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions vars/githubPr.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -182,12 +182,14 @@ def getNextCommentMessage(previousCommentInfo = [:], isFinal = false) {
## :green_heart: Build Succeeded
* [continuous-integration/kibana-ci/pull-request](${env.BUILD_URL})
* Commit: ${getCommitHash()}
${getDocsChangesLink()}
"""
} else if(status == 'UNSTABLE') {
def message = """
## :yellow_heart: Build succeeded, but was flaky
* [continuous-integration/kibana-ci/pull-request](${env.BUILD_URL})
* Commit: ${getCommitHash()}
${getDocsChangesLink()}
""".stripIndent()

def failures = retryable.getFlakyFailures()
Expand All @@ -204,6 +206,7 @@ def getNextCommentMessage(previousCommentInfo = [:], isFinal = false) {
* 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)
${getDocsChangesLink()}
"""
}

Expand Down Expand Up @@ -292,6 +295,21 @@ def getCommitHash() {
return env.ghprbActualCommit
}

def getDocsChangesLink() {
def url = "https://kibana_${env.ghprbPullId}.docs-preview.app.elstc.co/diff"

try {
// httpRequest throws on status codes >400 and failures
httpRequest([ method: "GET", url: url ])
return "* [Documentation Changes](${url})"
} catch (ex) {
print "Failed to reach ${url}"
buildUtils.printStacktrace(ex)
}

return ""
}

def getFailedSteps() {
return jenkinsApi.getFailedSteps()?.findAll { step ->
step.displayName != 'Check out from version control'
Expand Down

0 comments on commit 3f96892

Please sign in to comment.