diff --git a/src/org/ods/services/BitbucketService.groovy b/src/org/ods/services/BitbucketService.groovy index 5bcf21246..c1487759d 100644 --- a/src/org/ods/services/BitbucketService.groovy +++ b/src/org/ods/services/BitbucketService.groovy @@ -176,7 +176,7 @@ class BitbucketService { "locked": false, "reviewers": [${reviewers ? reviewers.collect { "{\"user\": { \"name\": \"${it}\" }}" }.join(',') : ''}] }""" - return withTokenCredentials { _, token -> + return withTokenCredentials { username, token -> def url = "${bitbucketUrl}/rest/api/1.0/projects/${project}/repos/${repo}/pull-requests" return this.httpRequestService.asString( HttpRequestService.HTTP_METHOD_POST, @@ -327,7 +327,8 @@ class BitbucketService { payload += "]" + "}" try { - def url = "${bitbucketUrl}/rest/insights/1.0/projects/${project}/repos/${repo}/commits/${gitCommit}/reports/${data.key}" + def url = "${bitbucketUrl}" + + "/rest/insights/1.0/projects/${project}/repos/${repo}/commits/${gitCommit}/reports/${data.key}" this.httpRequestService.asString( HttpRequestService.HTTP_METHOD_PUT, HttpRequestService.AUTHORIZATION_SCHEME_BEARER, @@ -429,11 +430,11 @@ class BitbucketService { } String getToken() { - withTokenCredentials { username, token -> return token} + withTokenCredentials { username, token -> return token } } @NonCPS - Map getCommitsForIntegrationBranch(String token, String repo, int limit, int nextPageStart){ + Map getCommitsForIntegrationBranch(String token, String repo, int limit, int nextPageStart) { String request = "${bitbucketUrl}/rest/api/1.0/projects/${project}/repos/${repo}/commits" return queryRepo(token, request, limit, nextPageStart) } @@ -449,10 +450,10 @@ class BitbucketService { private Map queryRepo(String token, String request, int limit, int nextPageStart) { Map headers = buildHeaders(token) def httpRequest = Unirest.get(request).headers(headers) - if (limit>0) { + if (limit > 0) { httpRequest.queryString("limit", limit) } - if (nextPageStart>0) { + if (nextPageStart > 0) { httpRequest.queryString("start", nextPageStart) } def response = httpRequest.asString() diff --git a/src/org/ods/services/HttpRequestService.groovy b/src/org/ods/services/HttpRequestService.groovy index fd8c7eb78..fa118da45 100644 --- a/src/org/ods/services/HttpRequestService.groovy +++ b/src/org/ods/services/HttpRequestService.groovy @@ -20,7 +20,6 @@ class HttpRequestService { HttpRequestService(def script, ILogger logger) { this.script = script this.logger = logger - } @NonCPS @@ -51,4 +50,5 @@ class HttpRequestService { } return response.body } + } diff --git a/vars/odsComponentStageCopyImage.groovy b/vars/odsComponentStageCopyImage.groovy index 91ac401e1..57f3a6b08 100644 --- a/vars/odsComponentStageCopyImage.groovy +++ b/vars/odsComponentStageCopyImage.groovy @@ -19,13 +19,13 @@ def call(IContext context, Map config = [:]) { // [REGISTRY/]REPO/IMAGE[:TAG] if (sourceImageDataSplitLength >= 2) { - config.image = sourceImageData[sourceImageDataSplitLength-1] - config.repo = sourceImageData[sourceImageDataSplitLength-2] + config.image = sourceImageData[sourceImageDataSplitLength - 1] + config.repo = sourceImageData[sourceImageDataSplitLength - 2] // no registry info, use internal cluster registry if (sourceImageDataSplitLength == 2) { config.registry = context.clusterRegistryAddress } else { - config.registry = sourceImageData[0..sourceImageDataSplitLength-3].join('/') + config.registry = sourceImageData[0..sourceImageDataSplitLength - 3].join('/') } config.registry = STR_DOCKER_PROTOCOL + config.registry } else { @@ -54,6 +54,5 @@ def call(IContext context, Map config = [:]) { def buildResourceName = "imported-${imageName}" odsComponentStageScanWithAqua(context, [resourceName: "${buildResourceName}", imageLabels: context.extensionImageLabels]) - } return this