automated terminal push
This commit is contained in:
30
Jenkinsfile
vendored
30
Jenkinsfile
vendored
@@ -56,12 +56,15 @@ pipeline {
|
|||||||
// Use Docker for consistent, isolated build environment
|
// Use Docker for consistent, isolated build environment
|
||||||
docker.image(env.BUILD_IMAGE).inside('-e HOME=/tmp -e PIP_CACHE_DIR=/tmp/.pip') {
|
docker.image(env.BUILD_IMAGE).inside('-e HOME=/tmp -e PIP_CACHE_DIR=/tmp/.pip') {
|
||||||
sh '''
|
sh '''
|
||||||
|
# Add local bin to PATH
|
||||||
|
export PATH="/tmp/.local/bin:$PATH"
|
||||||
|
|
||||||
# Corporate standard: CodeArtifact primary, PyPI fallback
|
# Corporate standard: CodeArtifact primary, PyPI fallback
|
||||||
export PIP_INDEX_URL="${CODEART_URL}"
|
export PIP_INDEX_URL="${CODEART_URL}"
|
||||||
export PIP_EXTRA_INDEX_URL="https://pypi.org/simple/"
|
export PIP_EXTRA_INDEX_URL="https://pypi.org/simple/"
|
||||||
|
|
||||||
# Install build dependencies
|
# Install build dependencies
|
||||||
pip install --upgrade setuptools wheel twine
|
pip install --user --upgrade setuptools wheel twine
|
||||||
|
|
||||||
# Build the package
|
# Build the package
|
||||||
python3 setup.py sdist bdist_wheel
|
python3 setup.py sdist bdist_wheel
|
||||||
@@ -99,11 +102,14 @@ pipeline {
|
|||||||
script {
|
script {
|
||||||
docker.image(env.BUILD_IMAGE).inside('-e HOME=/tmp -e PIP_CACHE_DIR=/tmp/.pip') {
|
docker.image(env.BUILD_IMAGE).inside('-e HOME=/tmp -e PIP_CACHE_DIR=/tmp/.pip') {
|
||||||
sh '''
|
sh '''
|
||||||
|
# Add local bin to PATH
|
||||||
|
export PATH="/tmp/.local/bin:$PATH"
|
||||||
|
|
||||||
# Corporate standard: CodeArtifact primary, PyPI fallback
|
# Corporate standard: CodeArtifact primary, PyPI fallback
|
||||||
export PIP_INDEX_URL="${CODEART_URL}"
|
export PIP_INDEX_URL="${CODEART_URL}"
|
||||||
export PIP_EXTRA_INDEX_URL="https://pypi.org/simple/"
|
export PIP_EXTRA_INDEX_URL="https://pypi.org/simple/"
|
||||||
|
|
||||||
pip install safety
|
pip install --user safety
|
||||||
safety check --json --output safety-report.json || true
|
safety check --json --output safety-report.json || true
|
||||||
'''
|
'''
|
||||||
}
|
}
|
||||||
@@ -119,20 +125,24 @@ pipeline {
|
|||||||
script {
|
script {
|
||||||
docker.image(env.BUILD_IMAGE).inside('-e HOME=/tmp -e PIP_CACHE_DIR=/tmp/.pip') {
|
docker.image(env.BUILD_IMAGE).inside('-e HOME=/tmp -e PIP_CACHE_DIR=/tmp/.pip') {
|
||||||
sh '''
|
sh '''
|
||||||
|
# Add local bin to PATH
|
||||||
|
export PATH="/tmp/.local/bin:$PATH"
|
||||||
|
|
||||||
# Corporate standard: CodeArtifact primary, PyPI fallback
|
# Corporate standard: CodeArtifact primary, PyPI fallback
|
||||||
export PIP_INDEX_URL="${CODEART_URL}"
|
export PIP_INDEX_URL="${CODEART_URL}"
|
||||||
export PIP_EXTRA_INDEX_URL="https://pypi.org/simple/"
|
export PIP_EXTRA_INDEX_URL="https://pypi.org/simple/"
|
||||||
|
|
||||||
# Install test dependencies if they exist
|
# Install test dependencies if they exist
|
||||||
if [ -f requirements-test.txt ]; then
|
if [ -f requirements-test.txt ]; then
|
||||||
pip install -r requirements-test.txt
|
pip install --user -r requirements-test.txt
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Install the built package for testing
|
# Install the built package for testing
|
||||||
pip install dist/*.whl
|
pip install --user dist/*.whl
|
||||||
|
|
||||||
# Run tests if they exist
|
# Run tests if they exist
|
||||||
if [ -f pytest.ini ] || [ -d tests ]; then
|
if [ -f pytest.ini ] || [ -d tests ]; then
|
||||||
|
pip install --user pytest
|
||||||
python -m pytest --junitxml=test-results.xml || true
|
python -m pytest --junitxml=test-results.xml || true
|
||||||
fi
|
fi
|
||||||
'''
|
'''
|
||||||
@@ -144,7 +154,7 @@ pipeline {
|
|||||||
// Publish test results if they exist
|
// Publish test results if they exist
|
||||||
script {
|
script {
|
||||||
if (fileExists('test-results.xml')) {
|
if (fileExists('test-results.xml')) {
|
||||||
publishTestResults testResultsPattern: 'test-results.xml'
|
junit 'test-results.xml'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -156,6 +166,16 @@ pipeline {
|
|||||||
script {
|
script {
|
||||||
docker.image(env.BUILD_IMAGE).inside('-e HOME=/tmp') {
|
docker.image(env.BUILD_IMAGE).inside('-e HOME=/tmp') {
|
||||||
sh '''
|
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
|
# Configure twine for CodeArtifact in /tmp
|
||||||
cat > /tmp/.pypirc <<EOF
|
cat > /tmp/.pypirc <<EOF
|
||||||
[distutils]
|
[distutils]
|
||||||
|
Reference in New Issue
Block a user