66 lines
2.7 KiB
Plaintext
66 lines
2.7 KiB
Plaintext
pipeline {
|
|
agent any
|
|
|
|
triggers {
|
|
// 'H' tells Jenkins to balance the load, running roughly every 30 minutes
|
|
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 '''
|
|
# Create a virtual environment named 'venv'
|
|
python3 -m venv venv
|
|
|
|
# Activate it and install your packages
|
|
. venv/bin/activate
|
|
|
|
# Install required packages
|
|
pip install -U atproto tweety-ns playwright httpx arrow python-dotenv moviepy
|
|
|
|
# Check if moviepy is installed
|
|
python3 -c "from moviepy.editor import VideoFileClip" || { echo 'MoviePy installation failed!'; exit 1; }
|
|
|
|
# Install the local browser binaries for this environment
|
|
playwright install chromium
|
|
'''
|
|
}
|
|
}
|
|
|
|
stage('Run Script') {
|
|
steps {
|
|
// Securely injects Jenkins credentials as environment variables
|
|
withCredentials([
|
|
string(credentialsId: 'TWITTER_USERNAME', variable: 'TWITTER_USERNAME'),
|
|
string(credentialsId: 'TWITTER_PASSWORD', variable: 'TWITTER_PASSWORD'),
|
|
string(credentialsId: 'TWITTER_3CAT_EMAIL', variable: 'TWITTER_3CAT_EMAIL'),
|
|
string(credentialsId: 'TWITTER_3CAT_HANDLE', variable: 'TWITTER_3CAT_HANDLE'),
|
|
string(credentialsId: 'BSKY_3CAT_HANDLE', variable: 'BSKY_3CAT_HANDLE'),
|
|
string(credentialsId: 'BSKY_3CAT_APP_PASSWORD', variable: 'BSKY_3CAT_APP_PASSWORD')
|
|
]) {
|
|
sh '''
|
|
# 1. Activate the virtual environment in THIS shell
|
|
. venv/bin/activate
|
|
|
|
# 2. Now run the script (it will use the venv's Python and find 'arrow')
|
|
python3 twitter2bsky_daemon.py \
|
|
--twitter-username "$TWITTER_USERNAME" \
|
|
--twitter-password "$TWITTER_PASSWORD" \
|
|
--twitter-email "$TWITTER_3CAT_EMAIL" \
|
|
--twitter-handle "$TWITTER_3CAT_HANDLE" \
|
|
--bsky-handle "$BSKY_3CAT_HANDLE" \
|
|
--bsky-password "$BSKY_3CAT_APP_PASSWORD"
|
|
'''
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} |