Ajouter vars/(shared-library-repo)/ └── vars/pythonBuildPipeline.groovy

This commit is contained in:
nadir committed 2026-09-30 14:33:36 +00:00
1 parent 1e667040d6
commit 356faba67a
1 file changed
+47
@@ -0,0 +1,47 @@
def call(Map config = [:]) {
def pythonVersion = config.get('PYTHON_VERSION', '3.12-slim')
def environment = config.get('ENVIRONMENT', 'DEV')
pipeline {
agent none
parameters {
string(name: 'PYTHON_VERSION', defaultValue: pythonVersion, description: 'Version de l\'image Python')
choice(name: 'ENVIRONMENT', choices: ['DEV', 'PROD'], description: 'Environnement de déploiement')
}
stages {
stage('Package') {
agent {
kubernetes {
yaml """
apiVersion: v1
kind: Pod
spec:
containers:
- name: build
image: python:${params.PYTHON_VERSION}
command: ["sleep"]
args: ["infinity"]
env:
- name: ENV_TYPE
value: "${params.ENVIRONMENT}"
"""
}
}
steps {
container('build') {
sh '''
echo "Image Python utilisée : python:${PYTHON_VERSION}"
echo "Environnement ciblé : ${ENVIRONMENT}"
echo "Nom de l'hôte dans le pod : $(hostname)"
echo "webhook"
sleep 5
echo "done"
'''
}
}
}
}
}
}