From 31d6364ecabdf40fb00e9788536fec0d5e7ad444 Mon Sep 17 00:00:00 2001 From: Henry Borchers Date: Tue, 19 Nov 2024 11:08:11 -0600 Subject: [PATCH] ci: Deploy to pypi uses generic python docker image --- Jenkinsfile | 55 ++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 46 insertions(+), 9 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 19b55522..bfd75e7a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1364,11 +1364,18 @@ pipeline { stage('Deploy'){ parallel { stage('Deploy to pypi') { + environment{ + PIP_CACHE_DIR='/tmp/pipcache' + UV_INDEX_STRATEGY='unsafe-best-match' + UV_TOOL_DIR='/tmp/uvtools' + UV_PYTHON_INSTALL_DIR='/tmp/uvpython' + UV_CACHE_DIR='/tmp/uvcache' + } agent { - dockerfile { - filename 'ci/docker/linux/jenkins/Dockerfile' - label 'linux && docker && x86' - additionalBuildArgs '--build-arg PIP_EXTRA_INDEX_URL' + docker{ + image 'python' + label 'docker && linux' + args '--mount source=python-tmp-py3exiv2bind,target=/tmp' } } when{ @@ -1398,12 +1405,42 @@ pipeline { wheelStashes.each{ unstash it } + withEnv( + [ + "TWINE_REPOSITORY_URL=${SERVER_URL}", + 'UV_INDEX_STRATEGY=unsafe-best-match' + ] + ){ + withCredentials( + [ + usernamePassword( + credentialsId: 'jenkins-nexus', + passwordVariable: 'TWINE_PASSWORD', + usernameVariable: 'TWINE_USERNAME' + ) + ]){ + sh( + label: 'Uploading to pypi', + script: '''python3 -m venv venv + trap "rm -rf venv" EXIT + . ./venv/bin/activate + pip install --disable-pip-version-check uv + uvx --with-requirements=requirements-dev.txt twine upload --disable-progress-bar --non-interactive dist/* + ''' + ) + } + } + } + } + post{ + cleanup{ + cleanWs( + deleteDirs: true, + patterns: [ + [pattern: 'dist/', type: 'INCLUDE'] + ] + ) } - pypiUpload( - credentialsId: 'jenkins-nexus', - repositoryUrl: SERVER_URL, - glob: 'dist/*' - ) } } stage('Deploy Online Documentation') {