up3
This commit is contained in:
@@ -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'"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user