Added All

This commit is contained in:
Guillem Hernandez Sola
2026-03-29 18:43:15 +02:00
parent a980d5cbbf
commit ff64fd9a4f

View File

@@ -2,14 +2,13 @@ pipeline {
agent any agent any
triggers { triggers {
// 'H' tells Jenkins to balance the load, running roughly every 30 minutes // 'H' balances the load on Jenkins, running roughly every 30 minutes
cron('H/30 * * * *') cron('H/30 * * * *')
} }
stages { stages {
stage('Checkout Code') { stage('Checkout Code') {
steps { steps {
// Pulls the code from the repository where this Jenkinsfile lives
checkout scm checkout scm
} }
} }
@@ -20,11 +19,11 @@ pipeline {
# Create a virtual environment named 'venv' # Create a virtual environment named 'venv'
python3 -m venv venv python3 -m venv venv
# Activate it and install your packages # Activate it and install the required packages
. venv/bin/activate . venv/bin/activate
pip install -U atproto tweety-ns playwright httpx arrow python-dotenv -q pip install -U atproto tweety-ns playwright httpx arrow python-dotenv -q
# Install the local browser binaries for this environment # Install the local browser binaries for this specific environment
playwright install chromium playwright install chromium
''' '''
} }
@@ -32,27 +31,27 @@ pipeline {
stage('Run Script') { stage('Run Script') {
steps { steps {
// Securely injects Jenkins credentials as environment variables // Securely inject Jenkins credentials as environment variables
withCredentials([ withCredentials([
string(credentialsId: 'TWITTER_USERNAME', variable: 'TWITTER_USERNAME'), string(credentialsId: 'TWITTER_USERNAME', variable: 'TWITTER_USERNAME'),
string(credentialsId: 'TWITTER_PASSWORD', variable: 'TWITTER_PASSWORD'), string(credentialsId: 'TWITTER_PASSWORD', variable: 'TWITTER_PASSWORD'),
string(credentialsId: 'TWITTER_3CAT_EMAIL', variable: 'TWITTER_3CAT_EMAIL'), string(credentialsId: 'TWITTER_CAT112_EMAIL', variable: 'TWITTER_CAT112_EMAIL'),
string(credentialsId: 'TWITTER_3CAT_HANDLE', variable: 'TWITTER_3CAT_HANDLE'), string(credentialsId: 'TWITTER_BOMBERSCAT_HANDLE', variable: 'TWITTER_BOMBERSCAT_HANDLE'),
string(credentialsId: 'BSKY_3CAT_HANDLE', variable: 'BSKY_3CAT_HANDLE'), string(credentialsId: 'BSKY_CAT112_HANDLE', variable: 'BSKY_CAT112_HANDLE'),
string(credentialsId: 'BSKY_3CAT_APP_PASSWORD', variable: 'BSKY_3CAT_APP_PASSWORD') string(credentialsId: 'BSKY_CAT112_PASSWORD', variable: 'BSKY_CAT112_PASSWORD')
]) { ]) {
sh ''' sh '''
# 1. Activate the virtual environment in THIS shell # Activate the exact same virtual environment so Python finds Playwright and Arrow
. venv/bin/activate . venv/bin/activate
# 2. Now run the script (it will use the venv's Python and find 'arrow') # Run the daemon with the injected credentials
python3 twitter2bsky_daemon.py \ python3 twitter2bsky_daemon.py \
--twitter-username "$TWITTER_USERNAME" \ --twitter-username "$TWITTER_USERNAME" \
--twitter-password "$TWITTER_PASSWORD" \ --twitter-password "$TWITTER_PASSWORD" \
--twitter-email "$TWITTER_3CAT_EMAIL" \ --twitter-email "$TWITTER_CAT112_EMAIL" \
--twitter-handle "$TWITTER_3CAT_HANDLE" \ --twitter-handle "$TWITTER_BOMBERSCAT_HANDLE" \
--bsky-handle "$BSKY_3CAT_HANDLE" \ --bsky-handle "$BSKY_CAT112_HANDLE" \
--bsky-password "$BSKY_3CAT_APP_PASSWORD" --bsky-password "$BSKY_CAT112_PASSWORD"
''' '''
} }
} }