Files
post2bsky/jenkins/FCBMasiaTw
Guillem Hernandez Sola f20708daf7 Added new yml
2026-03-29 20:05:47 +02:00

61 lines
2.3 KiB
Plaintext

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_FCB_EMAIL', variable: 'TWITTER_FCB_EMAIL'),
string(credentialsId: 'TWITTER_FCBMASIA_HANDLE', variable: 'TWITTER_FCBMASIA_HANDLE'),
string(credentialsId: 'BSKY_MQUB_HANDLE', variable: 'BSKY_MQUB_HANDLE'),
string(credentialsId: 'BSKY_MQUB_PASSWORD', variable: 'BSKY_MQUB_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_FCB_EMAIL" \
--twitter-handle "$TWITTER_FCBMASIA_HANDLE" \
--bsky-handle "$BSKY_MQUB_HANDLE" \
--bsky-password "$BSKY_MQUB_PASSWORD"
'''
}
}
}
}
}