Flag for picking hash or version in the package name

This commit is contained in:
Jim Nicholson 2024-02-13 03:39:49 -08:00
parent 7106512a7f
commit d709c036ce

View File

@ -8,7 +8,8 @@ void call(Map config = [:], Closure body = { }) {
extension: 'tgz', extension: 'tgz',
artifacts: [], artifacts: [],
stepName: 'Package', stepName: 'Package',
separator: '-' separator: '-',
useHash: false
] ]
Map runConfig = defaults + config Map runConfig = defaults + config
stage(runConfig.stepName) { stage(runConfig.stepName) {
@ -16,7 +17,13 @@ void call(Map config = [:], Closure body = { }) {
if (runConfig.artifacts.size() < 1) { if (runConfig.artifacts.size() < 1) {
assert runConfig.artifacts : 'Error: No named artifacts to package!' assert runConfig.artifacts : 'Error: No named artifacts to package!'
} }
archiveName = runConfig.name + runConfig.separator + runConfig.tag + runConfig.separator + runConfig.extension if (runConfig.useHash) {
archiveName = runConfig.name +
runConfig.separator +
(runConfig.useHash ? runConfig.version : runConfig.tag) +
runConfig.separator +
runConfig.extension
}
echo "Will tag result as: ${archiveName}" echo "Will tag result as: ${archiveName}"
sh """ sh """