From 7c97ddb96dffdae86f0d7d9dde247d076a96c7e8 Mon Sep 17 00:00:00 2001 From: hborcher Date: Mon, 4 May 2026 09:31:25 -0500 Subject: [PATCH] ci: test packages offline before trying with online access --- vars/runJenkinsPipeline.groovy | 85 +++++++++++++++++++++------------- 1 file changed, 54 insertions(+), 31 deletions(-) diff --git a/vars/runJenkinsPipeline.groovy b/vars/runJenkinsPipeline.groovy index c9e8143..2dc6249 100644 --- a/vars/runJenkinsPipeline.groovy +++ b/vars/runJenkinsPipeline.groovy @@ -502,8 +502,8 @@ def call(){ ' --tmpfs /.local/bin:exec' + ' --tmpfs /.local/share:exec' : - "--mount type=volume,source=uv_python_cache_dir,target=C:\\Users\\ContainerUser\\Documents\\uvpython" + - ' --mount type=volume,source=uv_cache_dir,target=C:\\Users\\ContainerUser\\Documents\\cache\\uvcache' + "--mount type=volume,source=uv_python_cache_dir,target=C:\\Users\\ContainerUser\\Documents\\uvpython " + + '--mount type=volume,source=uv_cache_dir,target=C:\\Users\\ContainerUser\\Documents\\cache\\uvcache' ){ if(isUnix()){ withEnv([ @@ -513,12 +513,17 @@ def call(){ 'UV_CACHE_DIR=/tmp/uvcache', "UV_CONFIG_FILE=${createUVConfig()}", ]){ - sh( - label: 'Testing with tox', - script: """uv python install cpython-${entry.PYTHON_VERSION} - 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('.', '')} - """ - ) + sh "uv python install cpython-${entry.PYTHON_VERSION}" + def attempt = 0 + retry(2){ + attempt += 1 + withEnv([(attempt == 1) ? 'UV_OFFLINE=1' : 'UV_OFFLINE=0']){ + sh( + label: "Testing with tox: ${(attempt == 1) ? 'Offline' : 'Online'}", + 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('.', '')}" + ) + } + } } } else { withEnv([ @@ -529,14 +534,20 @@ def call(){ "UV_CONFIG_FILE=${createUVConfig()}", "TOX_UV_PATH=${WORKSPACE}\\venv\\Scripts\\uv.exe", ]){ - bat( - label: 'Testing with tox', - script: """python -m venv venv - .\\venv\\Scripts\\pip install --disable-pip-version-check uv - .\\venv\\Scripts\\uv python install cpython-${entry.PYTHON_VERSION} - .\\venv\\Scripts\\uv run --only-group=tox-uv --isolated --frozen tox --installpkg ${findFiles(glob: entry.PACKAGE_TYPE == 'wheel' ? 'dist/*.whl' : 'dist/*.tar.gz')[0].path} -e py${entry.PYTHON_VERSION.replace('.', '')} - """ - ) + bat """python -m venv venv + .\\venv\\Scripts\\pip install --disable-pip-version-check uv + .\\venv\\Scripts\\uv python install cpython-${entry.PYTHON_VERSION} + """ + def attempt = 0 + retry(2){ + attempt += 1 + withEnv([(attempt == 1) ? 'UV_OFFLINE=1' : 'UV_OFFLINE=0']){ + bat( + label: "Testing with tox: ${(attempt == 1) ? 'Offline' : 'Online'}", + script: ".\\venv\\Scripts\\uv run --only-group=tox-uv --isolated --frozen tox --installpkg ${findFiles(glob: entry.PACKAGE_TYPE == 'wheel' ? 'dist/*.whl' : 'dist/*.tar.gz')[0].path} -e py${entry.PYTHON_VERSION.replace('.', '')}" + ) + } + } } } } @@ -546,27 +557,39 @@ def call(){ "UV_CONFIG_FILE=${createUVConfig()}", "TOX_UV_PATH=${WORKSPACE}/venv/bin/uv", ]){ - sh( - label: 'Testing with tox', - script: """python3 -m venv venv - ./venv/bin/pip install --disable-pip-version-check uv - ./venv/bin/uv run --only-group=tox-uv --isolated --frozen tox --installpkg ${findFiles(glob: entry.PACKAGE_TYPE == 'wheel' ? 'dist/*.whl' : 'dist/*.tar.gz')[0].path} -e py${entry.PYTHON_VERSION.replace('.', '')} - """ - ) + sh '''python3 -m venv venv + ./venv/bin/pip install --disable-pip-version-check uv + ''' + def attempt = 0 + retry(2){ + attempt += 1 + withEnv([(attempt == 1) ? 'UV_OFFLINE=1' : 'UV_OFFLINE=0']){ + sh( + label: "Testing with tox: ${(attempt == 1) ? 'Offline' : 'Online'}", + script: "./venv/bin/uv run --only-group=tox-uv --isolated --frozen tox --installpkg ${findFiles(glob: entry.PACKAGE_TYPE == 'wheel' ? 'dist/*.whl' : 'dist/*.tar.gz')[0].path} -e py${entry.PYTHON_VERSION.replace('.', '')}" + ) + } + } } } else { withEnv([ "UV_CONFIG_FILE=${createUVConfig()}", "TOX_UV_PATH=${WORKSPACE}\\venv\\Scripts\\uv.exe", ]){ - bat( - label: 'Testing with tox', - script: """python -m venv venv - .\\venv\\Scripts\\pip install --disable-pip-version-check uv - .\\venv\\Scripts\\uv python install cpython-${entry.PYTHON_VERSION} - .\\venv\\Scripts\\uv run --only-group=tox-uv --isolated --frozen tox --installpkg ${findFiles(glob: entry.PACKAGE_TYPE == 'wheel' ? 'dist/*.whl' : 'dist/*.tar.gz')[0].path} -e py${entry.PYTHON_VERSION.replace('.', '')} - """ - ) + bat """python -m venv venv + .\\venv\\Scripts\\pip install --disable-pip-version-check uv + .\\venv\\Scripts\\uv python install cpython-${entry.PYTHON_VERSION} + """ + def attempt = 0 + retry(2){ + attempt += 1 + withEnv([(attempt == 1) ? 'UV_OFFLINE=1' : 'UV_OFFLINE=0']){ + bat( + label: "Testing with tox: ${(attempt == 1) ? 'Offline' : 'Online'}", + script: ".\\venv\\Scripts\\uv run --only-group=tox-uv --isolated --frozen tox --installpkg ${findFiles(glob: entry.PACKAGE_TYPE == 'wheel' ? 'dist/*.whl' : 'dist/*.tar.gz')[0].path} -e py${entry.PYTHON_VERSION.replace('.', '')}" + ) + } + } } } }