Skip to content

Commit

Permalink
Merge pull request #557 from UIUCLibrary/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
henryborchers authored Dec 12, 2024
2 parents dbf5ac2 + eb6c87d commit edd207c
Showing 1 changed file with 36 additions and 33 deletions.
69 changes: 36 additions & 33 deletions vars/runJenkinsPipeline.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
]
)
}
}
}
Expand All @@ -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')
Expand Down Expand Up @@ -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'],
]
)
}
}
}
}
}
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit edd207c

Please sign in to comment.