Refactor some console messages

This commit is contained in:
Jim Nicholson 2024-02-14 00:34:59 -08:00
parent 9e85196fe8
commit 6d901e46c6
3 changed files with 10 additions and 10 deletions

View File

@ -45,10 +45,10 @@ Map call(Map config = [:], Map queryParams = [:]) {
plugin. */ plugin. */
/* 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 '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 "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}")
} }
version = match[0][1] version = match[0][1]
@ -57,7 +57,7 @@ Map call(Map config = [:], Map queryParams = [:]) {
} }
} else { } else {
version = '0.0.0' version = '0.0.0'
echo 'INFO: No matching assets found, assuming this is the first version.' echo 'Info: No matching assets found, assuming this is the first version.'
} }
return version return version
} }

View File

@ -24,7 +24,7 @@ void call(Map config = [:], Closure body = { }) {
runConfig.separator + runConfig.separator +
runConfig.extension runConfig.extension
echo "Will tag result as: ${archiveName}" echo "Info: Will archive results as: ${archiveName}."
sh """ sh """
if command -v "${runConfig.archiveCmd}"; then if command -v "${runConfig.archiveCmd}"; then

View File

@ -27,36 +27,36 @@ void call(Map config = [:], Closure body) {
printBanner(runConfig.stepName) printBanner(runConfig.stepName)
ansiColor('css') { ansiColor('css') {
if (fileExists(runConfig.venvDir) && runConfig.recreateVenv) { if (fileExists(runConfig.venvDir) && runConfig.recreateVenv) {
echo 'INFO: Removing old venv from workspace.' echo 'Info: Removing old venv from workspace.'
dir(runConfig.venvDir) { dir(runConfig.venvDir) {
deleteDir() deleteDir()
} }
} }
if (!fileExists(runConfig.venvDir)) { if (!fileExists(runConfig.venvDir)) {
echo "INFO: Creating new venv in ${runConfig.venvDir}." echo "Info: Creating new venv in ${runConfig.venvDir}."
sh "${runConfig.pythonPath} -m venv ${runConfig.venvDir}" sh "${runConfig.pythonPath} -m venv ${runConfig.venvDir}"
} }
withEnv(venvEnv) { withEnv(venvEnv) {
List setupCmds = [] List setupCmds = []
if (runConfig.updatePip) { if (runConfig.updatePip) {
echo 'INFO: Will update pip if an update is available.' echo 'Info: Will update pip if an update is available.'
updateCmd = "${venvPython.join('/')} -m pip install --upgrade pip" updateCmd = "${venvPython.join('/')} -m pip install --upgrade pip"
setupCmds.add(updateCmd) setupCmds.add(updateCmd)
} }
if (runConfig.installPipTools) { if (runConfig.installPipTools) {
echo 'INFO: Will install pip-tools.' echo 'Info: Will install pip-tools.'
installCmd = "${venvPython.join('/')} -m pip install pip-tools" installCmd = "${venvPython.join('/')} -m pip install pip-tools"
setupCmds.add(installCmd) setupCmds.add(installCmd)
} }
if (fileExists(runConfig.requirementsFile)) { if (fileExists(runConfig.requirementsFile)) {
echo "INFO: Will resolve requirements from ${runConfig.requirementsFile}." echo "Info: Will resolve requirements from ${runConfig.requirementsFile}."
reqCmd = "pip-compile ${runConfig.requirementsFile}" reqCmd = "pip-compile ${runConfig.requirementsFile}"
setupCmds.add(reqCmd) setupCmds.add(reqCmd)
} }
if (!setupCmds.isEmpty()) { if (!setupCmds.isEmpty()) {
echo 'INFO: Beginning venv setup.' echo 'Info: Beginning venv setup.'
sh setupCmds.join('\n') sh setupCmds.join('\n')
} }
echo 'Executing closure...' echo 'Executing closure...'