Pipeline: use basic authentication when talking to Gerrit
The credential id used in the Jenkins pipeline is propagated
downstream to the pipeline script: reuse the same credentials
for any subsequent interaction with Gerrit via REST-API for
retrieving further change details.
Change-Id: Ia999297b4ece802a089971c3c9880c9d35bb8ec6
diff --git a/vars/gerritPipeline.groovy b/vars/gerritPipeline.groovy
index d3ac30a..cec06cd 100644
--- a/vars/gerritPipeline.groovy
+++ b/vars/gerritPipeline.groovy
@@ -122,7 +122,7 @@
def queryChangedFiles(url) {
def queryUrl = "${url}changes/${env.GERRIT_CHANGE_NUMBER}/revisions/${env.GERRIT_PATCHSET_REVISION}/files/"
- def response = httpRequest queryUrl
+ def response = httpRequest(url: queryUrl, authentication: env.GERRIT_CREDENTIALS_ID)
def files = response.getContent().substring(5)
def filesJson = new JsonSlurper().parseText(files)
return filesJson.keySet().findAll { it != "/COMMIT_MSG" }