From dad7ec78e5e5ac0c46bf2b73813e254f59f0f994 Mon Sep 17 00:00:00 2001 From: Ionel Andrei Cataon Date: Thu, 12 Feb 2026 16:15:47 +0200 Subject: [PATCH] u2 --- project2/jenkinsfile | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/project2/jenkinsfile b/project2/jenkinsfile index e986e24..755dd5e 100644 --- a/project2/jenkinsfile +++ b/project2/jenkinsfile @@ -3,9 +3,7 @@ pipeline { stages { stage('Checkout') { - steps { - checkout scm - } + steps { checkout scm } } stage('Lint Check') { @@ -24,8 +22,8 @@ pipeline { script { dir('project2') { sh "docker build -t quotes-app ." - // --network host rezolvă DNS în WSL - sh "docker run --rm --network host -e QUOTE_API_URL='https://api.quotable.io/random' quotes-app" + // Mapăm manual IP-ul pentru a sări peste problema de DNS + sh "docker run --rm --add-host api.quotable.io:104.21.23.210 -e QUOTE_API_URL='https://api.quotable.io/random' quotes-app" } } } @@ -34,10 +32,18 @@ pipeline { post { success { - sh "curl -X POST -H 'Content-Type: application/json' -d '{\"content\": \"✅ **SUCCESS**: Build #${env.BUILD_NUMBER} a trecut! Aplicația a rulat corect.\"}' 'https://discord.com/api/webhooks/1471492658336891013/T5s6ZKZjjDMHXc3k3jjZdk6m5EV12bKF1wda9d5I_gZJrsDZQ1m1m078IiLJwk38mqa'" + script { + def msg = "✅ **SUCCESS**: Build #${env.BUILD_NUMBER} a trecut cu succes!" + sh "echo '{\"content\": \"$msg\"}' > discord_success.json" + sh "curl -X POST -H 'Content-Type: application/json' -d @discord_success.json 'https://discord.com/api/webhooks/1471492658336891013/T5s6ZKZjjDMHXc3k3jjZdk6m5EV12bKF1wda9d5I_gZJrsDZQ1m1m078IiLJwk38mqa'" + } } failure { - sh "curl -X POST -H 'Content-Type: application/json' -d '{\"content\": \"❌ **FAILED**: Build #${env.BUILD_NUMBER} a eșuat. Verifică log-urile!\"}' 'https://discord.com/api/webhooks/1471492658336891013/T5s6ZKZjjDMHXc3k3jjZdk6m5EV12bKF1wda9d5I_gZJrsDZQ1m1m078IiLJwk38mqa'" + script { + def msg = "❌ **FAILED**: Build #${env.BUILD_NUMBER} a eșuat. Verifică DNS-ul sau codul!" + sh "echo '{\"content\": \"$msg\"}' > discord_fail.json" + sh "curl -X POST -H 'Content-Type: application/json' -d @discord_fail.json 'https://discord.com/api/webhooks/1471492658336891013/T5s6ZKZjjDMHXc3k3jjZdk6m5EV12bKF1wda9d5I_gZJrsDZQ1m1m078IiLJwk38mqa'" + } } } } \ No newline at end of file