This commit is contained in:
Ionel Andrei Cataon
2026-02-12 16:14:23 +02:00
parent 166d263b76
commit 03b12f8beb

View File

@@ -24,8 +24,8 @@ pipeline {
script { script {
dir('project2') { dir('project2') {
sh "docker build -t quotes-app ." sh "docker build -t quotes-app ."
// ADAUGĂM --dns 8.8.8.8 pentru a rezolva eroarea de conexiune API // --network host rezolvă DNS în WSL
sh "docker run --rm --dns 8.8.8.8 -e QUOTE_API_URL='https://api.quotable.io/random' quotes-app" sh "docker run --rm --network host -e QUOTE_API_URL='https://api.quotable.io/random' quotes-app"
} }
} }
} }
@@ -34,26 +34,10 @@ pipeline {
post { post {
success { success {
script { 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'"
def discordUrl = 'https://discord.com/api/webhooks/1471492658336891013/T5s6ZKZjjDMHXc3k3jjZdk6m5EV12bKF1wda9d5I_gZJrsDZQ1m1m078IiLJwk38mqa'
def payload = """
{
"content": "✅ **SUCCESS: Famous Quotes App**\\nBuild-ul #${env.BUILD_NUMBER} a trecut cu succes! Aplicația a rulat corect."
}
"""
sh "curl -X POST -H 'Content-Type: application/json' -d '${payload.trim()}' '${discordUrl}'"
}
} }
failure { failure {
script { 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'"
def discordUrl = 'https://discord.com/api/webhooks/1471492658336891013/T5s6ZKZjjDMHXc3k3jjZdk6m5EV12bKF1wda9d5I_gZJrsDZQ1m1m078IiLJwk38mqa'
def payload = """
{
"content": "❌ **FAILED: Famous Quotes App**\\nBuild-ul #${env.BUILD_NUMBER} a eșuat. Verifică log-urile din Jenkins!"
}
"""
sh "curl -X POST -H 'Content-Type: application/json' -d '${payload.trim()}' '${discordUrl}'"
}
} }
} }
} }