From 8f5b5d5e8df59bf0ac2564de6dbb3ffcb53db483 Mon Sep 17 00:00:00 2001 From: Thibault Pouch Date: Thu, 19 Mar 2026 21:03:36 +0100 Subject: [PATCH] refactor: Update descriptions and messages in Jenkins pipeline scripts for clarity --- Nest/build-docker-image.groovy | 28 ++++++++++++++-------------- Nest/deploy-stack.groovy | 34 +++++++++++++++++----------------- 2 files changed, 31 insertions(+), 31 deletions(-) diff --git a/Nest/build-docker-image.groovy b/Nest/build-docker-image.groovy index 9a9e9c8..c2356c2 100644 --- a/Nest/build-docker-image.groovy +++ b/Nest/build-docker-image.groovy @@ -5,17 +5,17 @@ pipeline { string( name: 'REPO_URL', defaultValue: 'https://git.crowmate.fr/crowmate/Nest.git', - description: 'URL du repo Gitea à cloner' + description: 'Gitea repository URL to clone' ) string( name: 'BRANCH', defaultValue: 'main', - description: 'Branche à builder' + description: 'Branch to build' ) string( name: 'IMAGE_TAG', defaultValue: 'latest', - description: 'Tag des images Docker (ex: latest, v1.0.0)' + description: 'Docker image tag (e.g. latest, v1.0.0)' ) } @@ -38,7 +38,7 @@ pipeline { credentialsId: env.GITEA_CREDENTIALS_ID ]] ]) - echo "✅ Repo cloné" + echo "Repository cloned" } } @@ -51,28 +51,28 @@ pipeline { )]) { sh ''' echo "$REGISTRY_PASS" | docker login ''' + env.REGISTRY + ''' -u "$REGISTRY_USER" --password-stdin - echo "✅ Connecté au registry Gitea" + echo "Connected to Gitea registry" ''' sh """ - echo "🔨 Build nest-api..." + echo "Build nest-api..." docker build -t ${env.REGISTRY}/${env.REGISTRY_OWNER}/nest-api:${params.IMAGE_TAG} ./nest-backend - echo "🔨 Build nest-front..." + echo "Build nest-front..." docker build -t ${env.REGISTRY}/${env.REGISTRY_OWNER}/nest-front:${params.IMAGE_TAG} ./nest-front - echo "🔨 Build nest-intra..." + echo "Build nest-intra..." docker build -t ${env.REGISTRY}/${env.REGISTRY_OWNER}/nest-intra:${params.IMAGE_TAG} ./nest-intra """ sh """ - echo "📤 Push nest-api..." + echo "Push nest-api..." docker push ${env.REGISTRY}/${env.REGISTRY_OWNER}/nest-api:${params.IMAGE_TAG} - echo "📤 Push nest-front..." + echo "Push nest-front..." docker push ${env.REGISTRY}/${env.REGISTRY_OWNER}/nest-front:${params.IMAGE_TAG} - echo "📤 Push nest-intra..." + echo "Push nest-intra..." docker push ${env.REGISTRY}/${env.REGISTRY_OWNER}/nest-intra:${params.IMAGE_TAG} """ @@ -85,13 +85,13 @@ pipeline { post { success { - echo "🎉 Images buildées et pushées avec succès (tag: ${params.IMAGE_TAG})" + echo "Images built and pushed successfully (tag: ${params.IMAGE_TAG})" } failure { - echo "💥 Échec du build/push" + echo "Build/push failed" } always { - // Nettoyage des images locales pour ne pas saturer le disque + // Clean local images to avoid filling up disk space sh """ docker rmi ${env.REGISTRY}/${env.REGISTRY_OWNER}/nest-api:${params.IMAGE_TAG} || true docker rmi ${env.REGISTRY}/${env.REGISTRY_OWNER}/nest-front:${params.IMAGE_TAG} || true diff --git a/Nest/deploy-stack.groovy b/Nest/deploy-stack.groovy index 4d1157b..660a3c7 100644 --- a/Nest/deploy-stack.groovy +++ b/Nest/deploy-stack.groovy @@ -5,22 +5,22 @@ pipeline { string( name: 'REPO_URL', defaultValue: 'https://git.crowmate.fr/crowmate/Nest.git', - description: 'URL du repo Gitea (pour récupérer le docker-compose.prod.yml)' + description: 'Gitea repository URL (to retrieve docker-compose.prod.yml)' ) string( name: 'BRANCH', defaultValue: 'main', - description: 'Branche' + description: 'Branch' ) string( name: 'STACK_NAME', defaultValue: 'nest', - description: 'Nom de la stack dans Portainer' + description: 'Stack name in Portainer' ) string( name: 'IMAGE_TAG', defaultValue: 'latest', - description: 'Tag des images à déployer' + description: 'Image tag to deploy' ) } @@ -43,7 +43,7 @@ pipeline { credentialsId: env.GITEA_CREDENTIALS_ID ]] ]) - echo "✅ Repo cloné" + echo "Repository cloned" } } @@ -51,47 +51,47 @@ pipeline { steps { script { if (!fileExists('docker-compose.prod.yml')) { - error("❌ docker-compose.prod.yml introuvable à la racine du repo !") + error("docker-compose.prod.yml not found at the repository root") } - echo "✅ docker-compose.prod.yml trouvé" + echo "docker-compose.prod.yml found" } } } - stage('Deploy sur Portainer') { + stage('Deploy to Portainer') { steps { withCredentials([string(credentialsId: 'portainer-token', variable: 'PORTAINER_TOKEN')]) { sh ''' COMPOSE_CONTENT=$(base64 -w 0 docker-compose.prod.yml) - # Récupère la liste des stacks + # Get the list of stacks STACKS=$(curl -s -X GET "''' + env.PORTAINER_URL + '''/api/stacks" \ -H "X-API-Key: $PORTAINER_TOKEN") - # Cherche si la stack existe déjà + # Check whether the stack already exists STACK_ID=$(echo "$STACKS" | jq -r '.[] | select(.Name == "''' + params.STACK_NAME + '''") | .Id') if [ -n "$STACK_ID" ]; then - echo "🔄 Stack existante (ID: $STACK_ID), mise à jour..." + echo "Existing stack found (ID: $STACK_ID), updating..." RESPONSE=$(curl -s -X PUT "''' + env.PORTAINER_URL + '''/api/stacks/$STACK_ID?endpointId=''' + env.PORTAINER_ENV_ID + '''" \ -H "X-API-Key: $PORTAINER_TOKEN" \ -H "Content-Type: application/json" \ -d "{\"stackFileContent\": \"$COMPOSE_CONTENT\", \"prune\": true, \"pullImage\": true}") else - echo "🚀 Création de la stack ''' + params.STACK_NAME + '''..." + echo "Creating stack ''' + params.STACK_NAME + '''..." RESPONSE=$(curl -s -X POST "''' + env.PORTAINER_URL + '''/api/stacks/create/standalone/string?endpointId=''' + env.PORTAINER_ENV_ID + '''" \ -H "X-API-Key: $PORTAINER_TOKEN" \ -H "Content-Type: application/json" \ -d "{\"name\": \"''' + params.STACK_NAME + '''\", \"stackFileContent\": \"$COMPOSE_CONTENT\"}") fi - # Vérifie si la réponse contient une erreur + # Check whether the response contains an error if echo "$RESPONSE" | jq -e '.message' > /dev/null 2>&1; then - echo "❌ Erreur Portainer : $(echo $RESPONSE | jq -r '.message')" + echo "Portainer error: $(echo $RESPONSE | jq -r '.message')" exit 1 fi - echo "✅ Stack déployée avec succès !" + echo "Stack deployed successfully" ''' } } @@ -101,10 +101,10 @@ pipeline { post { success { - echo "🎉 Stack '${params.STACK_NAME}' déployée sur Portainer (tag: ${params.IMAGE_TAG})" + echo "Stack '${params.STACK_NAME}' deployed to Portainer (tag: ${params.IMAGE_TAG})" } failure { - echo "💥 Échec du déploiement de la stack '${params.STACK_NAME}'" + echo "Failed to deploy stack '${params.STACK_NAME}'" } } } \ No newline at end of file