up3
This commit is contained in:
@@ -22,8 +22,7 @@ pipeline {
|
|||||||
script {
|
script {
|
||||||
dir('project2') {
|
dir('project2') {
|
||||||
sh "docker build -t quotes-app ."
|
sh "docker build -t quotes-app ."
|
||||||
// Folosim HTTP pentru a evita handshake-ul SSL problematic si adaugam host-ul manual
|
sh "docker run --rm -e QUOTE_API_URL='https://zenquotes.io/api/random' quotes-app"
|
||||||
sh "docker run --rm --add-host api.quotable.io:104.21.23.210 -e QUOTE_API_URL='http://api.quotable.io/random' quotes-app"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -33,16 +32,20 @@ pipeline {
|
|||||||
post {
|
post {
|
||||||
always {
|
always {
|
||||||
script {
|
script {
|
||||||
// Mapam manual IP-ul Discord (162.159.135.232) pentru a asigura trimiterea
|
def discordUrl = "https://discord.com/api/webhooks/1471492658336891013/T5s6ZKZjjDMHXc3k3jjZdk6m5EV12bKF1wda9d5I_gZJrsDZQ1m1m078IiLJwk38mqa"
|
||||||
def discordIP = "162.159.135.232"
|
|
||||||
def webhookUrl = "https://discord.com/api/webhooks/1471492658336891013/T5s6ZKZjjDMHXc3k3jjZdk6m5EV12bKF1wda9d5I_gZJrsDZQ1m1m078IiLJwk38mqa"
|
|
||||||
|
|
||||||
// Determinam mesajul in functie de statusul build-ului
|
def statusEmoji = currentBuild.result == 'SUCCESS' ? "✅" : "❌"
|
||||||
def status = currentBuild.result == 'SUCCESS' ? "✅ SUCCESS" : "❌ FAILED"
|
def statusText = currentBuild.result == 'SUCCESS' ? "SUCCESS" : "FAILED"
|
||||||
def payload = "{\"content\": \"**$status**: Build #${env.BUILD_NUMBER} pe branch-ul develop.\"}"
|
|
||||||
|
|
||||||
echo "Trimitere notificare Discord..."
|
// Cream un fisier JSON curat pentru a evita erorile de ghilimele
|
||||||
sh "curl -X POST -H 'Content-Type: application/json' --resolve discord.com:443:$discordIP -d '$payload' '$webhookUrl'"
|
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