p2
This commit is contained in:
@@ -1,5 +1,11 @@
|
||||
pipeline {
|
||||
agent any
|
||||
|
||||
// Această secțiune spune Jenkins-ului să ruleze build-ul la fiecare 5 minute
|
||||
triggers {
|
||||
cron('*/5 * * * *')
|
||||
}
|
||||
|
||||
stages {
|
||||
stage('Build') {
|
||||
steps {
|
||||
@@ -15,6 +21,7 @@ pipeline {
|
||||
script {
|
||||
dir('project2') {
|
||||
sh "docker rm -f quotes-worker || true"
|
||||
// Rulăm cu DNS setat pentru a evita erorile de rețea anterioare
|
||||
sh "docker run --name quotes-worker --dns 8.8.8.8 quotes-app"
|
||||
sh "docker cp quotes-worker:/app/quote.txt . "
|
||||
}
|
||||
@@ -28,13 +35,12 @@ pipeline {
|
||||
def discordUrl = "https://discord.com/api/webhooks/1471492658336891013/T5s6ZKZjJjDMHXc3k3jjZdk6m5EV12bKF1wda9d5I_gZJrsDZQ1m1m078IiLJWK38mqa"
|
||||
def quote = fileExists('project2/quote.txt') ? readFile('project2/quote.txt').trim() : "Nu am putut genera citatul."
|
||||
|
||||
// Escapăm citatul pentru JSON
|
||||
def safeQuote = quote.replace('\\', '\\\\').replace('"', '\\"').replace('\n', '\\n')
|
||||
|
||||
sh """
|
||||
cat << 'EOF' > payload.json
|
||||
{
|
||||
"content": "✅ **Pipeline Finalizat (Build #${env.BUILD_NUMBER})**\\n\\n${safeQuote}"
|
||||
"content": "✅ **Pipeline Automat (Build #${env.BUILD_NUMBER})**\\n\\n${safeQuote}"
|
||||
}
|
||||
EOF
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user