From 36fbf4788cac9ab68c8a9a6ec23a659a492dc1e4 Mon Sep 17 00:00:00 2001 From: lenape Date: Sun, 29 Jun 2025 18:44:36 +0000 Subject: [PATCH] automated terminal push --- Jenkinsfile | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index a826891..0a83d34 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -56,12 +56,15 @@ pipeline { // Use Docker for consistent, isolated build environment docker.image(env.BUILD_IMAGE).inside('-e HOME=/tmp -e PIP_CACHE_DIR=/tmp/.pip') { sh ''' + # Add local bin to PATH + export PATH="/tmp/.local/bin:$PATH" + # Corporate standard: CodeArtifact primary, PyPI fallback export PIP_INDEX_URL="${CODEART_URL}" export PIP_EXTRA_INDEX_URL="https://pypi.org/simple/" # Install build dependencies - pip install --upgrade setuptools wheel twine + pip install --user --upgrade setuptools wheel twine # Build the package python3 setup.py sdist bdist_wheel @@ -99,11 +102,14 @@ pipeline { script { docker.image(env.BUILD_IMAGE).inside('-e HOME=/tmp -e PIP_CACHE_DIR=/tmp/.pip') { sh ''' + # Add local bin to PATH + export PATH="/tmp/.local/bin:$PATH" + # Corporate standard: CodeArtifact primary, PyPI fallback export PIP_INDEX_URL="${CODEART_URL}" export PIP_EXTRA_INDEX_URL="https://pypi.org/simple/" - pip install safety + pip install --user safety safety check --json --output safety-report.json || true ''' } @@ -119,20 +125,24 @@ pipeline { script { docker.image(env.BUILD_IMAGE).inside('-e HOME=/tmp -e PIP_CACHE_DIR=/tmp/.pip') { sh ''' + # Add local bin to PATH + export PATH="/tmp/.local/bin:$PATH" + # Corporate standard: CodeArtifact primary, PyPI fallback export PIP_INDEX_URL="${CODEART_URL}" export PIP_EXTRA_INDEX_URL="https://pypi.org/simple/" # Install test dependencies if they exist if [ -f requirements-test.txt ]; then - pip install -r requirements-test.txt + pip install --user -r requirements-test.txt fi # Install the built package for testing - pip install dist/*.whl + pip install --user dist/*.whl # Run tests if they exist if [ -f pytest.ini ] || [ -d tests ]; then + pip install --user pytest python -m pytest --junitxml=test-results.xml || true fi ''' @@ -144,7 +154,7 @@ pipeline { // Publish test results if they exist script { if (fileExists('test-results.xml')) { - publishTestResults testResultsPattern: 'test-results.xml' + junit 'test-results.xml' } } } @@ -156,6 +166,16 @@ pipeline { script { docker.image(env.BUILD_IMAGE).inside('-e HOME=/tmp') { sh ''' + # Add local bin to PATH + export PATH="/tmp/.local/bin:$PATH" + + # Corporate standard: CodeArtifact primary, PyPI fallback + export PIP_INDEX_URL="${CODEART_URL}" + export PIP_EXTRA_INDEX_URL="https://pypi.org/simple/" + + # Install twine + pip install --user twine + # Configure twine for CodeArtifact in /tmp cat > /tmp/.pypirc <