Skip to content

Commit 8a413b5

Browse files
Spencerspalgerkibanamachine
authored
[7.11] [jenkins/prs] report docs changes url in PR comments (#89454) (#89908)
Co-authored-by: spalger <[email protected]> Co-authored-by: Kibana Machine <[email protected]> Co-authored-by: spalger <[email protected]> Co-authored-by: Kibana Machine <[email protected]>
1 parent c441be7 commit 8a413b5

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

vars/githubPr.groovy

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,12 +182,14 @@ def getNextCommentMessage(previousCommentInfo = [:], isFinal = false) {
182182
## :green_heart: Build Succeeded
183183
* [continuous-integration/kibana-ci/pull-request](${env.BUILD_URL})
184184
* Commit: ${getCommitHash()}
185+
${getDocsChangesLink()}
185186
"""
186187
} else if(status == 'UNSTABLE') {
187188
def message = """
188189
## :yellow_heart: Build succeeded, but was flaky
189190
* [continuous-integration/kibana-ci/pull-request](${env.BUILD_URL})
190191
* Commit: ${getCommitHash()}
192+
${getDocsChangesLink()}
191193
""".stripIndent()
192194

193195
def failures = retryable.getFlakyFailures()
@@ -204,6 +206,7 @@ def getNextCommentMessage(previousCommentInfo = [:], isFinal = false) {
204206
* Commit: ${getCommitHash()}
205207
* [Pipeline Steps](${env.BUILD_URL}flowGraphTable) (look for red circles / failed steps)
206208
* [Interpreting CI Failures](https://www.elastic.co/guide/en/kibana/current/interpreting-ci-failures.html)
209+
${getDocsChangesLink()}
207210
"""
208211
}
209212

@@ -292,6 +295,21 @@ def getCommitHash() {
292295
return env.ghprbActualCommit
293296
}
294297

298+
def getDocsChangesLink() {
299+
def url = "https://kibana_${env.ghprbPullId}.docs-preview.app.elstc.co/diff"
300+
301+
try {
302+
// httpRequest throws on status codes >400 and failures
303+
httpRequest([ method: "GET", url: url ])
304+
return "* [Documentation Changes](${url})"
305+
} catch (ex) {
306+
print "Failed to reach ${url}"
307+
buildUtils.printStacktrace(ex)
308+
}
309+
310+
return ""
311+
}
312+
295313
def getFailedSteps() {
296314
return jenkinsApi.getFailedSteps()?.findAll { step ->
297315
step.displayName != 'Check out from version control'

0 commit comments

Comments
 (0)