Fix version format

This commit is contained in:
Jim Nicholson 2024-02-26 15:25:25 -08:00
parent d14d02717d
commit ddf1534abd
3 changed files with 9 additions and 7 deletions

View File

@ -45,7 +45,7 @@ Map call(Map config = [:], Map queryParams = [:]) {
/* groovylint-disable-next-line Instanceof */ /* groovylint-disable-next-line Instanceof */
if (latest.version instanceof net.sf.json.JSONNull && latest.name) { if (latest.version instanceof net.sf.json.JSONNull && latest.name) {
echo 'Info: Search result version field was null, looking in name field for a version' echo 'Info: Search result version field was null, looking in name field for a version'
java.util.regex.Matcher match = (latest.name =~ /(?<=-)(\d+\.\d+\.\d+)(?=[\.-].*)/) java.util.regex.Matcher match = (latest.name =~ /(?<=-)(\d+\.\d+\.\d+)(?=[\.].*)/)
if (!match) { if (!match) {
echo "Error: Match: ${match}" echo "Error: Match: ${match}"
error("Regular expression match failed for latest.name: ${latest.name}") error("Regular expression match failed for latest.name: ${latest.name}")

View File

@ -22,7 +22,7 @@ String call(Map config = [:], Closure body = { }) {
archiveName = runConfig.name + archiveName = runConfig.name +
runConfig.separator + runConfig.separator +
(runConfig.useHash ? runConfig.hash : runConfig.version) + (runConfig.useHash ? runConfig.hash : runConfig.version) +
runConfig.separator + '.' +
runConfig.extension runConfig.extension
echo "Info: Will archive results as: ${archiveName}." echo "Info: Will archive results as: ${archiveName}."

View File

@ -1,16 +1,18 @@
void call(Map config = [:], String packageName) { void call(Map config = [:], String packageName) {
publishURL = [ config.nexusBase, config.nexusRepository, config.nexusRepoPath, packageName ].join('/') publishURL = [ config.nexusBase, 'repository', config.nexusRepository, config.nexusRepoPath, packageName ].join('/')
echo 'Info: Publishing...' echo 'Info: Publishing...'
echo "Info: ${publishURL}" echo "Info: ${publishURL}"
response = httpRequest httpMode: 'POST', response = httpRequest authentication: 'publisher',
authenticate: 'publisher',
consoleLogResponseBody: true, consoleLogResponseBody: true,
contentType: 'APPLICATION_FORM_DATA', contentType: 'APPLICATION_FORM_DATA',
url: publishURL, url: publishURL,
wrapAsMultipart: true, wrapAsMultipart: true,
requestBody: [$class: 'FileRequestBody', file: packageName] httpMode: 'PUT',
validResponseCodes: '201',
multipartName: "${packageName}",
uploadFile: packageName
echo "Response: ${response.content}" echo "Response: ${response.content}"
} }