diff --git a/vars/pythonBuildPipeline.groovy b/vars/pythonBuildPipeline.groovy index 5838b82..46b5546 100644 --- a/vars/pythonBuildPipeline.groovy +++ b/vars/pythonBuildPipeline.groovy @@ -1,12 +1,12 @@ def call(Map config = [:]) { - def pythonVersion = config.get('PYTHON_VERSION', '3.12-slim') - def environment = config.get('ENVIRONMENT', 'DEV') + def defaultPythonVersion = config.get('PYTHON_VERSION', '3.12-slim') + def defaultEnvironment = config.get('ENVIRONMENT', 'DEV') pipeline { agent none 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') } @@ -14,25 +14,14 @@ def call(Map config = [:]) { 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}" -""" + // Charge le fichier pod.yaml depuis le dossier resources/templates/ + yaml libraryResource('templates/pod.yaml') } } steps { container('build') { sh ''' - echo "Image Python utilisée : python:${PYTHON_VERSION}" + echo "Image Python utilisée : ${PYTHON_VERSION}" echo "Environnement ciblé : ${ENVIRONMENT}" echo "Nom de l'hôte dans le pod : $(hostname)" echo "webhook"