[7.x] [jenkins/prs] report docs changes url in PR comments (#89454) (#89907)

Co-authored-by: spalger <spalger@users.noreply.github.com>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>

Co-authored-by: spalger <spalger@users.noreply.github.com>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
Spencer 2021-02-01 13:30:23 -07:00 committed by GitHub
parent a7d8ade9e9
commit 75c6e12654
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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()
@ -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()}
"""
}
@ -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'