Files
it_school/project2/jenkinsfile
Ionel Andrei Cataon dad7ec78e5 u2
2026-02-12 16:15:47 +02:00

49 lines
1.8 KiB
Plaintext

pipeline {
agent any
stages {
stage('Checkout') {
steps { checkout scm }
}
stage('Lint Check') {
steps {
script {
dir('project2') {
sh "docker build -t lint-test ."
sh "docker run --rm lint-test python -m py_compile famousquotes.py"
}
}
}
}
stage('Build & Run') {
steps {
script {
dir('project2') {
sh "docker build -t quotes-app ."
// Mapăm manual IP-ul pentru a sări peste problema de DNS
sh "docker run --rm --add-host api.quotable.io:104.21.23.210 -e QUOTE_API_URL='https://api.quotable.io/random' quotes-app"
}
}
}
}
}
post {
success {
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 {
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'"
}
}
}
}