From 706286b5307abd055dcbaf152140f7e7217a3016 Mon Sep 17 00:00:00 2001 From: Guillem Hernandez Sola Date: Sun, 29 Mar 2026 19:01:27 +0200 Subject: [PATCH] Added new yml --- jenkins/crunchyTw | 60 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 jenkins/crunchyTw diff --git a/jenkins/crunchyTw b/jenkins/crunchyTw new file mode 100644 index 0000000..4994a23 --- /dev/null +++ b/jenkins/crunchyTw @@ -0,0 +1,60 @@ +pipeline { + agent any + + triggers { + // 'H' balances the load on Jenkins, running roughly every 30 minutes + cron('H/30 * * * *') + } + + stages { + stage('Checkout Code') { + steps { + checkout scm + } + } + + stage('Setup Python & Install Dependencies') { + steps { + sh ''' + # Create a virtual environment named 'venv' + python3 -m venv venv + + # Activate it and install the required packages + . venv/bin/activate + pip install -U atproto tweety-ns playwright httpx arrow python-dotenv -q + + # Install the local browser binaries for this specific 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_CRUNCHY_EMAIL', variable: 'TWITTER_CRUNCHY_EMAIL'), + string(credentialsId: 'TWITTER_CRUNCHYROLL_HANDLE', variable: 'TWITTER_CRUNCHYROLL_HANDLE'), + string(credentialsId: 'BSKY_CRUNCHYROLL_HANDLE', variable: 'BSKY_CRUNCHYROLL_HANDLE'), + string(credentialsId: 'BSKY_CRUNCHYROLL_APP_PASSWORD', variable: 'BSKY_CRUNCHYROLL_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_CRUNCHY_EMAIL" \ + --twitter-handle "$TWITTER_CRUNCHYROLL_HANDLE" \ + --bsky-handle "$BSKY_CRUNCHYROLL_HANDLE" \ + --bsky-password "$BSKY_CRUNCHYROLL_APP_PASSWORD" + ''' + } + } + } + } +}