diff --git a/vars/runJenkinsPipeline.groovy b/vars/runJenkinsPipeline.groovy index 481e9fea..7be4f442 100644 --- a/vars/runJenkinsPipeline.groovy +++ b/vars/runJenkinsPipeline.groovy @@ -502,32 +502,26 @@ def call(){ def image = docker.build(UUID.randomUUID().toString(), '-f ci/docker/python/linux/jenkins/Dockerfile .') try{ image.inside('--mount source=python-tmp-speedwagon,target=/tmp'){ - try{ - sh( label: 'Running Tox', - script: """python3 -m venv venv && venv/bin/pip install --disable-pip-version-check uv - . ./venv/bin/activate - uv python install cpython-${version} - uvx -p ${version} --with tox-uv tox run -e ${toxEnv} - """ - ) - } catch(e) { - sh(script: '''. ./venv/bin/activate - uv python list - ''' - ) - throw e - } finally{ - cleanWs( - patterns: [ - [pattern: 'venv/', type: 'INCLUDE'], - [pattern: '.tox/', type: 'INCLUDE'], - [pattern: '**/__pycache__/', type: 'INCLUDE'], - ] + sh( label: 'Running Tox', + script: """python3 -m venv venv && venv/bin/pip install --disable-pip-version-check uv + trap "rm -rf venv" EXIT + . ./venv/bin/activate + uv python install cpython-${version} + trap "rm -rf ./venv ./.tox" EXIT + uvx -p ${version} --with tox-uv tox run -e ${toxEnv} + """ ) - } } } finally { sh "docker image rm --force ${image.imageName()}" + sh "${tool(name: 'Default', type: 'git')} clean -dfx" + cleanWs( + patterns: [ + [pattern: 'venv/', type: 'INCLUDE'], + [pattern: '.tox/', type: 'INCLUDE'], + [pattern: '**/__pycache__/', type: 'INCLUDE'], + ] + ) } } } @@ -553,7 +547,7 @@ def call(){ script{ def envs = [] node('docker && windows'){ - docker.image('python').inside('--mount source=python-tmp-speedwagon,target=C:\\Users\\ContainerUser\\Documents'){ + docker.image('python').inside("--mount source=uv_python_install_dir,target=${env.UV_PYTHON_INSTALL_DIR}"){ try{ checkout scm bat(script: 'python -m venv venv && venv\\Scripts\\pip install --disable-pip-version-check uv') @@ -581,26 +575,35 @@ def call(){ { node('docker && windows'){ try{ - docker.image('python').inside('--mount source=python-tmp-speedwagon,target=C:\\Users\\ContainerUser\\Documents --mount source=msvc-runtime,target=$VC_RUNTIME_INSTALLER_LOCATION'){ + docker.image('python').inside("--mount source=uv_python_install_dir,target=${env.UV_PYTHON_INSTALL_DIR}"){ checkout scm retry(3){ bat(label: 'Running Tox', script: """python -m venv venv && venv\\Scripts\\pip install --disable-pip-version-check uv venv\\Scripts\\uv python install cpython-${version} venv\\Scripts\\uvx -p ${version} --with tox-uv tox run -e ${toxEnv} - rmdir /S /Q venv """ ) } } } finally{ - cleanWs( - patterns: [ - [pattern: 'venv/', type: 'INCLUDE'], - [pattern: '.tox', type: 'INCLUDE'], - [pattern: '**/__pycache__/', type: 'INCLUDE'], - ] - ) + retry(3){ + try{ + bat "${tool(name: 'Default', type: 'git')} clean -dfx" + } catch(e) { + echo 'failed to run git clean, sleeping for one second before moving forward to see if any processes are still running' + sleep 1 + throw e + } finally{ + cleanWs( + patterns: [ + [pattern: 'venv/', type: 'INCLUDE'], + [pattern: '.tox', type: 'INCLUDE'], + [pattern: '**/__pycache__/', type: 'INCLUDE'], + ] + ) + } + } } } } @@ -730,7 +733,7 @@ def call(){ docker { image 'python' label "${OS} && ${ARCHITECTURE} && docker" - args "--mount source=python-tmp-speedwagon,target=${['windows'].contains(OS) ? 'C:\\Users\\ContainerUser\\Documents': '/tmp'} ${['windows'].contains(OS) ? '--mount source=msvc-runtime,target=c:\\msvc_runtime\\': ''}" + args "--mount source=uv_python_install_dir,target=${env.UV_PYTHON_INSTALL_DIR} ${['windows'].contains(OS) ? '--mount source=msvc-runtime,target=c:\\msvc_runtime\\': ''}" } } steps {