This commit is contained in:
Ionel Andrei Cataon
2026-02-12 16:15:47 +02:00
parent 03b12f8beb
commit dad7ec78e5

View File

@@ -3,9 +3,7 @@ pipeline {
stages { stages {
stage('Checkout') { stage('Checkout') {
steps { steps { checkout scm }
checkout scm
}
} }
stage('Lint Check') { stage('Lint Check') {
@@ -24,8 +22,8 @@ pipeline {
script { script {
dir('project2') { dir('project2') {
sh "docker build -t quotes-app ." sh "docker build -t quotes-app ."
// --network host rezolvă DNS în WSL // Mapăm manual IP-ul pentru a sări peste problema de DNS
sh "docker run --rm --network host -e QUOTE_API_URL='https://api.quotable.io/random' quotes-app" 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 { post {
success { 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 { 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'"
}
} }
} }
} }