From fd9ad40f4bb03ad473ab7d1ab66a5a8d1301121c Mon Sep 17 00:00:00 2001 From: Guillem Hernandez Sola Date: Mon, 11 May 2026 11:10:15 +0200 Subject: [PATCH] =?UTF-8?q?Afegit=20el=20Rac=C3=B3=20del=20Manga?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jenkins/elRacoDelMangaTw | 82 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 jenkins/elRacoDelMangaTw diff --git a/jenkins/elRacoDelMangaTw b/jenkins/elRacoDelMangaTw new file mode 100644 index 0000000..9a324e1 --- /dev/null +++ b/jenkins/elRacoDelMangaTw @@ -0,0 +1,82 @@ +pipeline { + agent any + + options { + timeout(time: 15, unit: 'MINUTES') + timestamps() + buildDiscarder(logRotator(numToKeepStr: '10')) + disableConcurrentBuilds() + } + + triggers { + cron('H/30 * * * *') + } + + stages { + + stage('Checkout Code') { + steps { + // Pulls the code from the repository where this Jenkinsfile lives + checkout scm + } + } + + stage('Setup Python & Install Dependencies') { + steps { + sh ''' + set -e # Exit immediately if a command exits with a non-zero status + + # Create a virtual environment named 'venv' + python3 -m venv venv + + # Activate the virtual environment and install dependencies + . venv/bin/activate && \ + pip install --upgrade pip && \ + pip install -U atproto tweety-ns playwright httpx arrow python-dotenv moviepy grapheme + + # Check if moviepy is installed + pip list | grep moviepy || { echo 'MoviePy installation failed!'; exit 1; } + + # Check if FFmpeg is installed + ffmpeg -version || { echo 'FFmpeg is not installed!'; exit 1; } + + # Verify that moviepy can be imported + python3 -c "import moviepy" || { echo 'MoviePy import failed!'; exit 1; } + + # Install the local browser binaries for this environment + playwright install chromium + ''' + } + } + + stage('Run Script') { + steps { + // Securely inject Jenkins credentials as environment variables + withCredentials([ + string(credentialsId: 'TWITTER_USERNAME', variable: 'TWITTER_USERNAME'), + string(credentialsId: 'TWITTER_PASSWORD', variable: 'TWITTER_PASSWORD'), + string(credentialsId: 'TWITTER_ELRACODELMANGA_EMAIL', variable: 'TWITTER_ELRACODELMANGA_EMAIL'), + string(credentialsId: 'TWITTER_ELRACODELMANGA_HANDLE', variable: 'TWITTER_ELRACODELMANGA_HANDLE'), + string(credentialsId: 'BSKY_ELRACODELMANGA_HANDLE', variable: 'BSKY_ELRACODELMANGA_HANDLE'), + string(credentialsId: 'BSKY_ELRACODELMANGA_APP_PASSWORD', variable: 'BSKY_ELRACODELMANGA_APP_PASSWORD') + ]) { + sh ''' + # Activate the exact same virtual environment so Python finds Playwright and Arrow + . venv/bin/activate + + # Run the daemon with the injected credentials + python3 twitter2bsky_daemon.py \ + --twitter-username "$TWITTER_USERNAME" \ + --twitter-password "$TWITTER_PASSWORD" \ + --twitter-email "$TWITTER_ELRACODELMANGA_EMAIL" \ + --twitter-handle "$TWITTER_ELRACODELMANGA_HANDLE" \ + --bsky-handle "$BSKY_ELRACODELMANGA_HANDLE" \ + --bsky-password "$BSKY_ELRACODELMANGA_APP_PASSWORD" \ + --bsky-base-url https://eurosky.social \ + --bsky-langs ca + ''' + } + } + } + } +}