Fixes on Jenkinsfiles

This commit is contained in:
Guillem Hernandez Sola
2026-05-08 08:47:58 +02:00
parent cb26dcc3ee
commit 83c0bd3443
3 changed files with 69 additions and 57 deletions

View File

@@ -2,18 +2,15 @@ pipeline {
agent any
triggers {
// Every Thursday at 07:15
cron('15 7 * * 4')
}
environment {
BSKY_HANDLE = credentials('BSKY_GROMENAWARE_HANDLE')
BSKY_APP_PASSWORD = credentials('BSKY_GROMENAWARE_APP_PASSWORD')
// Every Friday at 07:15
cron('15 7 * * 5')
}
options {
timeout(time: 10, unit: 'MINUTES')
buildDiscarder(logRotator(numToKeepStr: '30'))
timeout(time: 15, unit: 'MINUTES')
timestamps()
buildDiscarder(logRotator(numToKeepStr: '10'))
disableConcurrentBuilds()
}
stages {
@@ -28,16 +25,23 @@ pipeline {
}
}
stage('Post Dijous') {
stage('Post Divendres') {
steps {
sh """
. venv/bin/activate
python3 bsky_post.py "Feliç dijous!!!!" \\
--username "\$BSKY_HANDLE" \\
--password "\$BSKY_APP_PASSWORD" \\
--image media/dijous.jpg \\
--alt "Feliç dijous!!" \\
--lang ca
// Securely injects Jenkins credentials as environment variables
// Note the added curly braces wrapping the sh block
withCredentials([
string(credentialsId: 'BSKY_GROMENAWARE_HANDLE', variable: 'BSKY_GROMENAWARE_HANDLE'),
string(credentialsId: 'BSKY_GROMENAWARE_APP_PASSWORD', variable: 'BSKY_GROMENAWARE_APP_PASSWORD')
]) {
sh """
. venv/bin/activate
python3 bsky_post.py "Feliç dijous!!!!" \\
--username "\$BSKY_HANDLE" \\
--password "\$BSKY_APP_PASSWORD" \\
--image media/dijous.jpg \\
--alt "Feliç dijous!!" \\
--lang ca \\
--service https://eurosky.social
"""
}
}

View File

@@ -2,18 +2,15 @@ pipeline {
agent any
triggers {
// Every Sunday at 07:15
cron('15 21 * * 0')
}
environment {
BSKY_HANDLE = credentials('BSKY_GROMENAWARE_HANDLE')
BSKY_APP_PASSWORD = credentials('BSKY_GROMENAWARE_APP_PASSWORD')
// Every Friday at 07:15
cron('15 7 * * 5')
}
options {
timeout(time: 10, unit: 'MINUTES')
buildDiscarder(logRotator(numToKeepStr: '30'))
timeout(time: 15, unit: 'MINUTES')
timestamps()
buildDiscarder(logRotator(numToKeepStr: '10'))
disableConcurrentBuilds()
}
stages {
@@ -28,16 +25,23 @@ pipeline {
}
}
stage('Post Dijous') {
stage('Post diumenge Nit') {
steps {
sh """
. venv/bin/activate
python3 bsky_post.py "DEMÀ DILLUNS!!!!!!!!!!!!" \\
--username "\$BSKY_HANDLE" \\
--password "\$BSKY_APP_PASSWORD" \\
--image media/diumenge.mp4 \\
--alt "DEMÀ DILLUNS!!!!!!!!!!!!" \\
--lang ca
// Securely injects Jenkins credentials as environment variables
// Note the added curly braces wrapping the sh block
withCredentials([
string(credentialsId: 'BSKY_GROMENAWARE_HANDLE', variable: 'BSKY_GROMENAWARE_HANDLE'),
string(credentialsId: 'BSKY_GROMENAWARE_APP_PASSWORD', variable: 'BSKY_GROMENAWARE_APP_PASSWORD')
]) {
sh """
. venv/bin/activate
python3 bsky_post.py "DEMÀ DILLUNS!!!!!!!!!!!!" \\
--username "\$BSKY_HANDLE" \\
--password "\$BSKY_APP_PASSWORD" \\
--image media/diumenge.mp4 \\
--alt "DEMÀ DILLUNS!!!!!!!!!!!!" \\
--lang ca \\
--service https://eurosky.social
"""
}
}
@@ -45,10 +49,10 @@ pipeline {
post {
success {
echo '✅ Dijous post published successfully.'
echo '✅ Diumenge post published successfully.'
}
failure {
echo '❌ Dijous post failed.'
echo '❌ Diumenge post failed.'
}
}
}

View File

@@ -3,17 +3,14 @@ pipeline {
triggers {
// Every Friday at 07:15
cron('15 21 * * 5')
}
environment {
BSKY_HANDLE = credentials('BSKY_GROMENAWARE_HANDLE')
BSKY_APP_PASSWORD = credentials('BSKY_GROMENAWARE_APP_PASSWORD')
cron('15 7 * * 5')
}
options {
timeout(time: 10, unit: 'MINUTES')
buildDiscarder(logRotator(numToKeepStr: '30'))
timeout(time: 15, unit: 'MINUTES')
timestamps()
buildDiscarder(logRotator(numToKeepStr: '10'))
disableConcurrentBuilds()
}
stages {
@@ -28,16 +25,23 @@ pipeline {
}
}
stage('Post Dijous') {
stage('Post Divendres Nit') {
steps {
sh """
. venv/bin/activate
python3 bsky_post.py "DIVENDRES NIT PER FI!!!!!!!!!!!" \\
--username "\$BSKY_HANDLE" \\
--password "\$BSKY_APP_PASSWORD" \\
--image media/divendres_nit.mp4 \\
--alt "DIVENDRES NIT PER FI!!!!!!!!!!!" \\
--lang ca
// Securely injects Jenkins credentials as environment variables
// Note the added curly braces wrapping the sh block
withCredentials([
string(credentialsId: 'BSKY_GROMENAWARE_HANDLE', variable: 'BSKY_GROMENAWARE_HANDLE'),
string(credentialsId: 'BSKY_GROMENAWARE_APP_PASSWORD', variable: 'BSKY_GROMENAWARE_APP_PASSWORD')
]) {
sh """
. venv/bin/activate
python3 bsky_post.py "DIVENDRES NIT PER FI!!!!!!!!!!!" \\
--username "\$BSKY_HANDLE" \\
--password "\$BSKY_APP_PASSWORD" \\
--image media/divendres_nit.mp4 \\
--alt "DIVENDRES NIT PER FI!!!!!!!!!!!" \\
--lang ca \\
--service https://eurosky.social
"""
}
}
@@ -45,10 +49,10 @@ pipeline {
post {
success {
echo '✅ Dijous post published successfully.'
echo '✅ Divendres Nit post published successfully.'
}
failure {
echo '❌ Dijous post failed.'
echo '❌ Divendres Nit post failed.'
}
}
}