From 3ead2d22724ea50c2f295296f4c4d049d2fa8ffc Mon Sep 17 00:00:00 2001 From: Henry Borchers Date: Tue, 15 Oct 2024 12:41:48 -0500 Subject: [PATCH] ci: tox stages doesn't stall if no agents have the required labels --- Jenkinsfile | 68 +++++++++++++++++++++++++++++------------------------ 1 file changed, 37 insertions(+), 31 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 7d78ae0..0855ee7 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -355,38 +355,44 @@ pipeline { options { lock(env.JOB_URL) } - steps { - script{ - def windowsJobs - def linuxJobs - stage('Scanning Tox Environments'){ - parallel( - 'Linux':{ - linuxJobs = getToxTestsParallel( - envNamePrefix: 'Tox Linux', - label: 'linux && docker', - dockerfile: 'ci/docker/python/linux/tox/Dockerfile', - dockerArgs: '--build-arg PIP_EXTRA_INDEX_URL --build-arg PIP_INDEX_URL --build-arg PIP_DOWNLOAD_CACHE=/.cache/pip --build-arg UV_CACHE_DIR=/.cache/uv', - dockerRunArgs: '-v pipcache_hathizip:/.cache/pip', - retry: 2 - ) - }, - 'Windows':{ - windowsJobs = getToxTestsParallel( - envNamePrefix: 'Tox Windows', - label: 'windows && docker', - dockerfile: 'ci/docker/python/windows/tox/Dockerfile', - dockerArgs: '--build-arg PIP_EXTRA_INDEX_URL --build-arg PIP_INDEX_URL --build-arg CHOCOLATEY_SOURCE --build-arg chocolateyVersion --build-arg PIP_DOWNLOAD_CACHE=c:/users/containeradministrator/appdata/local/pip --build-arg UV_CACHE_DIR=c:/users/containeradministrator/appdata/local/uv', - dockerRunArgs: '-v pipcache_hathizip:c:/users/containeradministrator/appdata/local/pip -v uvcache_hathizip:c:/users/containeradministrator/appdata/local/uv', - retry: 2 - - ) - }, - failFast: true - ) + parallel{ + stage('Linux'){ + when{ + expression {return nodesByLabel('linux && docker && x86').size() > 0} } - stage('Run Tox'){ - parallel(windowsJobs + linuxJobs) + steps{ + script{ + parallel( + getToxTestsParallel( + envNamePrefix: 'Tox Linux', + label: 'linux && docker', + dockerfile: 'ci/docker/python/linux/tox/Dockerfile', + dockerArgs: '--build-arg PIP_EXTRA_INDEX_URL --build-arg PIP_INDEX_URL --build-arg PIP_DOWNLOAD_CACHE=/.cache/pip --build-arg UV_CACHE_DIR=/.cache/uv', + dockerRunArgs: '-v pipcache_hathizip:/.cache/pip', + retry: 2 + ) + ) + } + } + } + stage('Windows'){ + when{ + expression {return nodesByLabel('windows && docker && x86').size() > 0} + } + steps{ + script{ + parallel( + getToxTestsParallel( + envNamePrefix: 'Tox Windows', + label: 'windows && docker', + dockerfile: 'ci/docker/python/windows/tox/Dockerfile', + dockerArgs: '--build-arg PIP_EXTRA_INDEX_URL --build-arg PIP_INDEX_URL --build-arg CHOCOLATEY_SOURCE --build-arg chocolateyVersion --build-arg PIP_DOWNLOAD_CACHE=c:/users/containeradministrator/appdata/local/pip --build-arg UV_CACHE_DIR=c:/users/containeradministrator/appdata/local/uv', + dockerRunArgs: '-v pipcache_hathizip:c:/users/containeradministrator/appdata/local/pip -v uvcache_hathizip:c:/users/containeradministrator/appdata/local/uv', + retry: 2 + + ) + ) + } } } }