diff --git a/jenkins/btvBasicsTw b/jenkins/btvBasicsTw new file mode 100644 index 0000000..8c1910d --- /dev/null +++ b/jenkins/btvBasicsTw @@ -0,0 +1,74 @@ +pipeline { + agent any + + options { + skipDefaultCheckout(true) + } + + 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 + + # 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 injects Jenkins credentials as environment variables + withCredentials([ + string(credentialsId: 'TWITTER_USERNAME', variable: 'TWITTER_USERNAME'), + string(credentialsId: 'TWITTER_PASSWORD', variable: 'TWITTER_PASSWORD'), + string(credentialsId: 'TWITTER_BETEVE_EMAIL', variable: 'TWITTER_BETEVE_EMAIL'), + string(credentialsId: 'TWITTER_BTVESPORTS_HANDLE', variable: 'TWITTER_BTVESPORTS_HANDLE'), + string(credentialsId: 'BSKY_BETEVE_HANDLE', variable: 'BSKY_BETEVE_HANDLE'), + string(credentialsId: 'BSKY_BETEVE_APP_PASSWORD', variable: 'BSKY_BETEVE_APP_PASSWORD') + ]) { + sh ''' + # Activate the virtual environment and run the script + . venv/bin/activate && \ + python3 twitter2bsky_daemon.py \ + --twitter-username "$TWITTER_USERNAME" \ + --twitter-password "$TWITTER_PASSWORD" \ + --twitter-email "$TWITTER_BETEVE_EMAIL" \ + --twitter-handle "$TWITTER_BTVESPORTS_HANDLE" \ + --bsky-handle "$BSKY_BETEVE_HANDLE" \ + --bsky-password "$BSKY_BETEVE_APP_PASSWORD" + ''' + } + } + } + } +} \ No newline at end of file diff --git a/jenkins/polonia3CatTw b/jenkins/polonia3CatTw index 2a5f32c..37611ba 100644 --- a/jenkins/polonia3CatTw +++ b/jenkins/polonia3CatTw @@ -52,7 +52,7 @@ pipeline { 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: 'TWITTER_POLONIA3CAT_HANDLE', variable: 'TWITTER_POLONIA3CAT_HANDLE'), string(credentialsId: 'BSKY_3CAT_HANDLE', variable: 'BSKY_3CAT_HANDLE'), string(credentialsId: 'BSKY_3CAT_APP_PASSWORD', variable: 'BSKY_3CAT_APP_PASSWORD') ]) { @@ -63,7 +63,7 @@ pipeline { --twitter-username "$TWITTER_USERNAME" \ --twitter-password "$TWITTER_PASSWORD" \ --twitter-email "$TWITTER_3CAT_EMAIL" \ - --twitter-handle "$TWITTER_3CAT_HANDLE" \ + --twitter-handle "$TWITTER_POLONIA3CAT_HANDLE" \ --bsky-handle "$BSKY_3CAT_HANDLE" \ --bsky-password "$BSKY_3CAT_APP_PASSWORD" '''