automated terminal push

This commit is contained in:
lenape
2025-06-29 16:35:38 +00:00
parent 6ab5d280b6
commit 5ea60ff698

23
Jenkinsfile vendored
View File

@@ -8,7 +8,7 @@ pipeline {
CODEART_DOMAIN = credentials('CODEART_DOMAIN') CODEART_DOMAIN = credentials('CODEART_DOMAIN')
CODEART_REPO = credentials('CODEART_REPO') CODEART_REPO = credentials('CODEART_REPO')
// Build configuration // Build configuration - Corporate-friendly non-root approach
PYTHON_VERSION = '3.11-slim' PYTHON_VERSION = '3.11-slim'
BUILD_IMAGE = "python:${PYTHON_VERSION}" BUILD_IMAGE = "python:${PYTHON_VERSION}"
} }
@@ -54,10 +54,10 @@ pipeline {
steps { steps {
script { script {
// Use Docker for consistent, isolated build environment // Use Docker for consistent, isolated build environment
docker.image(env.BUILD_IMAGE).inside() { docker.image(env.BUILD_IMAGE).inside('-e HOME=/tmp -e PIP_CACHE_DIR=/tmp/.pip') {
sh ''' sh '''
# Configure pip to use CodeArtifact # Configure pip to use CodeArtifact without trying to save global config
pip config set global.index-url "${CODEART_URL}" export PIP_INDEX_URL="${CODEART_URL}"
# Install build dependencies # Install build dependencies
pip install --upgrade setuptools wheel twine pip install --upgrade setuptools wheel twine
@@ -96,8 +96,9 @@ pipeline {
} }
steps { steps {
script { script {
docker.image(env.BUILD_IMAGE).inside() { docker.image(env.BUILD_IMAGE).inside('-e HOME=/tmp -e PIP_CACHE_DIR=/tmp/.pip') {
sh ''' sh '''
export PIP_INDEX_URL="${CODEART_URL}"
pip install safety pip install safety
safety check --json --output safety-report.json || true safety check --json --output safety-report.json || true
''' '''
@@ -112,8 +113,10 @@ pipeline {
stage('Test') { stage('Test') {
steps { steps {
script { script {
docker.image(env.BUILD_IMAGE).inside() { docker.image(env.BUILD_IMAGE).inside('-e HOME=/tmp -e PIP_CACHE_DIR=/tmp/.pip') {
sh ''' sh '''
export PIP_INDEX_URL="${CODEART_URL}"
# 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 -r requirements-test.txt
@@ -148,10 +151,10 @@ pipeline {
} }
steps { steps {
script { script {
docker.image(env.BUILD_IMAGE).inside() { docker.image(env.BUILD_IMAGE).inside('-e HOME=/tmp') {
sh ''' sh '''
# Configure twine for CodeArtifact # Configure twine for CodeArtifact in /tmp
cat > ~/.pypirc <<EOF cat > /tmp/.pypirc <<EOF
[distutils] [distutils]
index-servers = codeartifact index-servers = codeartifact
@@ -162,7 +165,7 @@ password = ${CODEART_TOKEN}
EOF EOF
# Publish to CodeArtifact # Publish to CodeArtifact
twine upload --repository codeartifact dist/* twine upload --config-file /tmp/.pypirc --repository codeartifact dist/*
''' '''
} }
} }