From f507bf03b89a711f0d1b371b8b0ac91502eebfa8 Mon Sep 17 00:00:00 2001 From: Ionel Andrei Cataon Date: Thu, 12 Feb 2026 16:18:27 +0200 Subject: [PATCH] up3 --- project2/jenkinsfile | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/project2/jenkinsfile b/project2/jenkinsfile index 5fae9b6..2898710 100644 --- a/project2/jenkinsfile +++ b/project2/jenkinsfile @@ -22,8 +22,7 @@ pipeline { script { dir('project2') { sh "docker build -t quotes-app ." - // Folosim HTTP pentru a evita handshake-ul SSL problematic si adaugam host-ul manual - sh "docker run --rm --add-host api.quotable.io:104.21.23.210 -e QUOTE_API_URL='http://api.quotable.io/random' quotes-app" + sh "docker run --rm -e QUOTE_API_URL='https://zenquotes.io/api/random' quotes-app" } } } @@ -33,16 +32,20 @@ pipeline { post { always { script { - // Mapam manual IP-ul Discord (162.159.135.232) pentru a asigura trimiterea - def discordIP = "162.159.135.232" - def webhookUrl = "https://discord.com/api/webhooks/1471492658336891013/T5s6ZKZjjDMHXc3k3jjZdk6m5EV12bKF1wda9d5I_gZJrsDZQ1m1m078IiLJwk38mqa" + def discordUrl = "https://discord.com/api/webhooks/1471492658336891013/T5s6ZKZjjDMHXc3k3jjZdk6m5EV12bKF1wda9d5I_gZJrsDZQ1m1m078IiLJwk38mqa" - // Determinam mesajul in functie de statusul build-ului - def status = currentBuild.result == 'SUCCESS' ? "✅ SUCCESS" : "❌ FAILED" - def payload = "{\"content\": \"**$status**: Build #${env.BUILD_NUMBER} pe branch-ul develop.\"}" + def statusEmoji = currentBuild.result == 'SUCCESS' ? "✅" : "❌" + def statusText = currentBuild.result == 'SUCCESS' ? "SUCCESS" : "FAILED" - echo "Trimitere notificare Discord..." - sh "curl -X POST -H 'Content-Type: application/json' --resolve discord.com:443:$discordIP -d '$payload' '$webhookUrl'" + // Cream un fisier JSON curat pentru a evita erorile de ghilimele + writeFile file: 'discord.json', text: """ + { + "content": "$statusEmoji **$statusText**: Build #${env.BUILD_NUMBER} s-a terminat pe ramura develop." + } + """ + + echo "Trimitere notificare catre Discord..." + sh "curl -X POST -H 'Content-Type: application/json' -d @discord.json '$discordUrl'" } } }