Actualiser vars/pythonBuildPipeline.groovy

This commit is contained in:
nadir committed 2026-09-30 14:51:00 +00:00
1 parent 2f0232e9ba
commit b80114f9ac
1 file changed
+6 -17
+6 -17
View File
@@ -1,12 +1,12 @@
def call(Map config = [:]) { def call(Map config = [:]) {
def pythonVersion = config.get('PYTHON_VERSION', '3.12-slim') def defaultPythonVersion = config.get('PYTHON_VERSION', '3.12-slim')
def environment = config.get('ENVIRONMENT', 'DEV') def defaultEnvironment = config.get('ENVIRONMENT', 'DEV')
pipeline { pipeline {
agent none agent none
parameters { parameters {
string(name: 'PYTHON_VERSION', defaultValue: pythonVersion, description: 'Version de l\'image Python') string(name: 'PYTHON_VERSION', defaultValue: defaultPythonVersion, description: 'Version de l\'image Python')
choice(name: 'ENVIRONMENT', choices: ['DEV', 'PROD'], description: 'Environnement de déploiement') choice(name: 'ENVIRONMENT', choices: ['DEV', 'PROD'], description: 'Environnement de déploiement')
} }
@@ -14,25 +14,14 @@ def call(Map config = [:]) {
stage('Package') { stage('Package') {
agent { agent {
kubernetes { kubernetes {
yaml """ // Charge le fichier pod.yaml depuis le dossier resources/templates/
apiVersion: v1 yaml libraryResource('templates/pod.yaml')
kind: Pod
spec:
containers:
- name: build
image: python:${params.PYTHON_VERSION}
command: ["sleep"]
args: ["infinity"]
env:
- name: ENV_TYPE
value: "${params.ENVIRONMENT}"
"""
} }
} }
steps { steps {
container('build') { container('build') {
sh ''' sh '''
echo "Image Python utilisée : python:${PYTHON_VERSION}" echo "Image Python utilisée : ${PYTHON_VERSION}"
echo "Environnement ciblé : ${ENVIRONMENT}" echo "Environnement ciblé : ${ENVIRONMENT}"
echo "Nom de l'hôte dans le pod : $(hostname)" echo "Nom de l'hôte dans le pod : $(hostname)"
echo "webhook" echo "webhook"