Skip to content

Commit 6cba004

Browse files
committed
ci: improve caching
1 parent e1e13ea commit 6cba004

1 file changed

Lines changed: 22 additions & 31 deletions

File tree

vars/runJenkinsPipeline.groovy

Lines changed: 22 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ def call(){
220220
node('docker && linux'){
221221
checkout scm
222222
try{
223-
docker.image('ghcr.io/astral-sh/uv:debian').inside('--mount source=python-tmp-packageValidation,target=/tmp'){
223+
docker.image('ghcr.io/astral-sh/uv:debian').inside('--mount source=python-tmp-packageValidation,target=/tmp --tmpfs /ci_tmp:exec -e TOX_WORK_DIR=/ci_tmp/tox'){
224224
retry(2){
225225
try{
226226
envs = sh(
@@ -254,7 +254,7 @@ def call(){
254254
node('docker && linux'){
255255
checkout scm
256256
try{
257-
docker.image('ghcr.io/astral-sh/uv:debian').inside('--mount source=python-tmp-packageValidation,target=/tmp --tmpfs /.local/share:exec --tmpfs /.local/bin:exec'){
257+
docker.image('ghcr.io/astral-sh/uv:debian').inside('--mount source=python-tmp-packageValidation,target=/tmp --tmpfs /.local/share:exec --tmpfs /.local/bin:exec --tmpfs /ci_tmp:exec -e TOX_WORK_DIR=/ci_tmp/tox -e UV_PROJECT_ENVIRONMENT=/ci_tmp/venv'){
258258
try{
259259
sh( label: 'Running Tox',
260260
script: """uv python install cpython-${version}
@@ -321,37 +321,27 @@ def call(){
321321
checkout scm
322322
try{
323323
docker.image(env.DEFAULT_PYTHON_DOCKER_IMAGE ? env.DEFAULT_PYTHON_DOCKER_IMAGE: 'python').inside("--mount type=volume,source=uv_python_cache_dir,target=${env.UV_PYTHON_CACHE_DIR}"){
324-
try{
325-
bat(label: 'Install uv',
326-
script: 'python -m venv venv && venv\\Scripts\\pip install --disable-pip-version-check uv'
327-
)
328-
withEnv(["TOX_UV_PATH=${WORKSPACE}\\venv\\Scripts\\uv.exe"]){
329-
retry(3){
330-
try{
331-
bat(label: 'Running Tox',
332-
script: """venv\\Scripts\\uv python install cpython-${version}
333-
venv\\Scripts\\uv run --only-group=tox-uv tox run --runner uv-venv-lock-runner -e ${toxEnv}
334-
"""
335-
)
336-
} catch(e) {
337-
cleanWs(
338-
patterns: [
339-
[pattern: '.tox', type: 'INCLUDE'],
340-
[pattern: '**/__pycache__/', type: 'INCLUDE'],
341-
]
342-
)
343-
throw e
344-
}
324+
bat(label: 'Install uv',
325+
script: 'python -m venv venv && venv\\Scripts\\pip install --disable-pip-version-check uv'
326+
)
327+
withEnv(["TOX_UV_PATH=${WORKSPACE}\\venv\\Scripts\\uv.exe"]){
328+
retry(3){
329+
try{
330+
bat(label: 'Running Tox',
331+
script: """venv\\Scripts\\uv python install cpython-${version}
332+
venv\\Scripts\\uv run --only-group=tox-uv tox run --runner uv-venv-lock-runner -e ${toxEnv}
333+
"""
334+
)
335+
} catch(e) {
336+
cleanWs(
337+
patterns: [
338+
[pattern: '.tox', type: 'INCLUDE'],
339+
[pattern: '**/__pycache__/', type: 'INCLUDE'],
340+
]
341+
)
342+
throw e
345343
}
346344
}
347-
} finally{
348-
cleanWs(
349-
patterns: [
350-
[pattern: 'venv/', type: 'INCLUDE'],
351-
[pattern: '.tox', type: 'INCLUDE'],
352-
[pattern: '**/__pycache__/', type: 'INCLUDE'],
353-
]
354-
)
355345
}
356346
}
357347
} finally {
@@ -469,6 +459,7 @@ def call(){
469459
.inside(
470460
isUnix() ?
471461
'--mount source=python-tmp-packageValidation,target=/tmp' +
462+
' --tmpfs /.local/bin:exec' +
472463
' --tmpfs /.local/share:exec'
473464
:
474465
"--mount type=volume,source=uv_python_cache_dir,target=C:\\Users\\ContainerUser\\Documents\\uvpython" +

0 commit comments

Comments
 (0)