Skip to content

Commit

Permalink
make codenarc happ[y|ier]
Browse files Browse the repository at this point in the history
  • Loading branch information
serverhorror committed Oct 24, 2023
1 parent 3e31272 commit 17006d0
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
13 changes: 7 additions & 6 deletions src/org/ods/services/BitbucketService.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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)
}
Expand All @@ -449,10 +450,10 @@ class BitbucketService {
private Map queryRepo(String token, String request, int limit, int nextPageStart) {
Map<String, String> 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()
Expand Down
2 changes: 1 addition & 1 deletion src/org/ods/services/HttpRequestService.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ class HttpRequestService {
HttpRequestService(def script, ILogger logger) {
this.script = script
this.logger = logger

}

@NonCPS
Expand Down Expand Up @@ -51,4 +50,5 @@ class HttpRequestService {
}
return response.body
}

}
7 changes: 3 additions & 4 deletions vars/odsComponentStageCopyImage.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -54,6 +54,5 @@ def call(IContext context, Map config = [:]) {
def buildResourceName = "imported-${imageName}"
odsComponentStageScanWithAqua(context,
[resourceName: "${buildResourceName}", imageLabels: context.extensionImageLabels])

}
return this

0 comments on commit 17006d0

Please sign in to comment.