Fix key conflict

This commit is contained in:
Jim Nicholson 2024-02-07 21:08:34 -08:00
parent 7d15a7a8f9
commit 3ec31b4a79

View File

@ -1,6 +1,15 @@
#!/usr/bin/env groovy
// import java.net.URLEncoder
/*
Calculate the current version by querying a list of assets in a Nexus Repository.
Return '0.0.1' if there are no matching assets.
Jenkins Plugin dependencies:
- HTTP Request
- Plugin Utilty Steps
*/
Map call(Map config = [:]) {
Map defaults = [
@ -15,10 +24,18 @@ Map call(Map config = [:]) {
Map runConfig = defaults + config
nexusURL = runConfig.nexusBase + '/' + runConfig.searchAPI
nexusSearch = buildUrlWithQueryParams(nexusURL, runConfig.queryParams)
response = httpRequest acceptType: 'APPLICATION_JSON',
contentType: 'APPLICATION_JSON',
url: nexusSearch,
wrapAsMultipart: false
body = response.content
assets = readJSON text: body
latest = assets.items.last()
runConfig.nexusQuery = nexusSearch
runConfig.latestVersion = latest.name
return runConfig
}