Final cleanup
This commit is contained in:
parent
f38c8d069f
commit
62a7e91ba7
@ -27,33 +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 'Removing old venv...'
|
echo 'INFO: Removing old venv from workspace.'
|
||||||
dir(runConfig.venvDir) {
|
dir(runConfig.venvDir) {
|
||||||
deleteDir()
|
deleteDir()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!fileExists(runConfig.venvDir)) {
|
if (!fileExists(runConfig.venvDir)) {
|
||||||
createVenv = "${runConfig.pythonPath} -m venv ${runConfig.venvDir}"
|
echo "INFO: Creating new venv in ${runConfig.venvDir}."
|
||||||
echo "python create venv cmd is: ${createVenv}"
|
sh "${runConfig.pythonPath} -m venv ${runConfig.venvDir}"
|
||||||
sh createVenv
|
|
||||||
}
|
}
|
||||||
|
|
||||||
withEnv(venvEnv) {
|
withEnv(venvEnv) {
|
||||||
List setupCmds = []
|
List setupCmds = []
|
||||||
if (runConfig.updatePip) {
|
if (runConfig.updatePip) {
|
||||||
|
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.'
|
||||||
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}."
|
||||||
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.'
|
||||||
sh setupCmds.join('\n')
|
sh setupCmds.join('\n')
|
||||||
}
|
}
|
||||||
echo 'Executing closure...'
|
echo 'Executing closure...'
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user