Skip to content

Commit dcc8bbc

Browse files
committed
ci: attempt to test packages with offline cache before trying online
1 parent 7fc1a40 commit dcc8bbc

1 file changed

Lines changed: 53 additions & 29 deletions

File tree

Jenkinsfile

Lines changed: 53 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -456,12 +456,17 @@ pipeline {
456456
'UV_PYTHON_CACHE_DIR=/tmp/uvpython',
457457
'UV_CACHE_DIR=/tmp/uvcache',
458458
]){
459-
sh(
460-
label: 'Testing with tox',
461-
script: """uv python install cpython-${entry.PYTHON_VERSION}
462-
uv run --only-group=tox-uv --frozen tox --installpkg ${findFiles(glob: entry.PACKAGE_TYPE == 'wheel' ? 'dist/*.whl' : 'dist/*.tar.gz')[0].path} -e py${entry.PYTHON_VERSION.replace('.', '')}
463-
"""
464-
)
459+
sh "uv python install cpython-${entry.PYTHON_VERSION}"
460+
def attempt = 0
461+
retry(2){
462+
attempt += 1
463+
withEnv([(attempt == 1) ? 'UV_OFFLINE=1' : 'UV_OFFLINE=0']){
464+
sh(
465+
label: "Testing with tox: ${(attempt == 1) ? 'Offline' : 'Online'}",
466+
script: "uv run --only-group=tox-uv --frozen tox --installpkg ${findFiles(glob: entry.PACKAGE_TYPE == 'wheel' ? 'dist/*.whl' : 'dist/*.tar.gz')[0].path} -e py${entry.PYTHON_VERSION.replace('.', '')}"
467+
)
468+
}
469+
}
465470
}
466471
} else {
467472
withEnv([
@@ -471,38 +476,57 @@ pipeline {
471476
'UV_CACHE_DIR=C:\\Users\\ContainerUser\\Documents\\cache\\uvcache',
472477
"TOX_UV_PATH=${env.WORKSPACE}\\venv\\Scripts\\uv.exe",
473478
]){
474-
powershell(
475-
label: 'Testing with tox',
476-
script: """python -m venv venv
477-
.\\venv\\Scripts\\pip install --disable-pip-version-check uv
478-
.\\venv\\Scripts\\uv python install cpython-${entry.PYTHON_VERSION}
479-
.\\venv\\Scripts\\uv run --only-group=tox-uv --frozen tox --installpkg ${findFiles(glob: entry.PACKAGE_TYPE == 'wheel' ? 'dist/*.whl' : 'dist/*.tar.gz')[0].path} -e py${entry.PYTHON_VERSION.replace('.', '')}
480-
"""
481-
)
479+
bat """python -m venv venv
480+
.\\venv\\Scripts\\pip install --disable-pip-version-check uv
481+
.\\venv\\Scripts\\uv python install cpython-${entry.PYTHON_VERSION}
482+
"""
483+
def attempt = 0
484+
retry(2){
485+
attempt += 1
486+
withEnv([(attempt == 1) ? 'UV_OFFLINE=1' : 'UV_OFFLINE=0']){
487+
powershell(
488+
label: "Testing with tox: ${(attempt == 1) ? 'Offline' : 'Online'}",
489+
script: ".\\venv\\Scripts\\uv run --only-group=tox-uv --frozen tox --installpkg ${findFiles(glob: entry.PACKAGE_TYPE == 'wheel' ? 'dist/*.whl' : 'dist/*.tar.gz')[0].path} -e py${entry.PYTHON_VERSION.replace('.', '')}"
490+
)
491+
}
492+
}
482493
}
483494
}
484495
}
485496
} else {
486497
if(isUnix()){
498+
sh """python3 -m venv venv
499+
./venv/bin/pip install --disable-pip-version-check uv
500+
./venv/bin/uv python install cpython-${entry.PYTHON_VERSION}
501+
"""
487502
withEnv(["TOX_UV_PATH=${env.WORKSPACE}/venv/bin/uv"]){
488-
sh(
489-
label: 'Testing with tox',
490-
script: """python3 -m venv venv
491-
./venv/bin/pip install --disable-pip-version-check uv
492-
./venv/bin/uv run --python=${entry.PYTHON_VERSION} --only-group=tox-uv --frozen tox --installpkg ${findFiles(glob: entry.PACKAGE_TYPE == 'wheel' ? 'dist/*.whl' : 'dist/*.tar.gz')[0].path} -e py${entry.PYTHON_VERSION.replace('.', '')}
493-
"""
494-
)
503+
def attempt = 0
504+
retry(2){
505+
attempt += 1
506+
withEnv([(attempt == 1) ? 'UV_OFFLINE=1' : 'UV_OFFLINE=0']){
507+
sh(
508+
label: "Testing with tox: ${(attempt == 1) ? 'Offline' : 'Online'}",
509+
script: "./venv/bin/uv run --python=${entry.PYTHON_VERSION} --only-group=tox-uv --frozen tox --installpkg ${findFiles(glob: entry.PACKAGE_TYPE == 'wheel' ? 'dist/*.whl' : 'dist/*.tar.gz')[0].path} -e py${entry.PYTHON_VERSION.replace('.', '')}"
510+
)
511+
}
512+
}
495513
}
496514
} else {
515+
bat """python -m venv venv
516+
.\\venv\\Scripts\\pip install --disable-pip-version-check uv
517+
.\\venv\\Scripts\\uv python install cpython-${entry.PYTHON_VERSION}
518+
"""
497519
withEnv(["TOX_UV_PATH=${env.WORKSPACE}\\venv\\Scripts\\uv.exe"]){
498-
bat(
499-
label: 'Testing with tox',
500-
script: """python -m venv venv
501-
.\\venv\\Scripts\\pip install --disable-pip-version-check uv
502-
.\\venv\\Scripts\\uv python install cpython-${entry.PYTHON_VERSION}
503-
.\\venv\\Scripts\\uv run --only-group=tox-uv --frozen tox --installpkg ${findFiles(glob: entry.PACKAGE_TYPE == 'wheel' ? 'dist/*.whl' : 'dist/*.tar.gz')[0].path} -e py${entry.PYTHON_VERSION.replace('.', '')}
504-
"""
505-
)
520+
def attempt = 0
521+
retry(2){
522+
attempt += 1
523+
withEnv([(attempt == 1) ? 'UV_OFFLINE=1' : 'UV_OFFLINE=0']){
524+
bat(
525+
label: "Testing with tox: ${(attempt == 1) ? 'Offline' : 'Online'}",
526+
script: ".\\venv\\Scripts\\uv run --only-group=tox-uv --frozen tox --installpkg ${findFiles(glob: entry.PACKAGE_TYPE == 'wheel' ? 'dist/*.whl' : 'dist/*.tar.gz')[0].path} -e py${entry.PYTHON_VERSION.replace('.', '')}"
527+
)
528+
}
529+
}
506530
}
507531
}
508532
}

0 commit comments

Comments
 (0)