diff --git a/jenkins/crunchyRSS b/jenkins/crunchyRSS new file mode 100644 index 0000000..831e241 --- /dev/null +++ b/jenkins/crunchyRSS @@ -0,0 +1,52 @@ +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 for the RSS script + . venv/bin/activate + pip install atproto fastfeedparser beautifulsoup4 httpx arrow charset-normalizer + ''' + } + } + + stage('Run Script') { + steps { + // Securely inject Jenkins credentials as environment variables + withCredentials([ + string(credentialsId: 'BSKY_CRUNCHYROLL_HANDLE', variable: 'BSKY_CRUNCHYROLL_HANDLE'), + string(credentialsId: 'BSKY_CRUNCHYROLL_USERNAME', variable: 'BSKY_CRUNCHYROLL_USERNAME'), + string(credentialsId: 'BSKY_CRUNCHYROLL_APP_PASSWORD', variable: 'BSKY_CRUNCHYROLL_APP_PASSWORD') + ]) { + sh ''' + # Activate the virtual environment + . venv/bin/activate + + # Run the RSS script with positional arguments + python3 rss2bsky.py \ + "https://cr-news-api-service.prd.crunchyrollsvc.com/v1/es-ES/rss" \ + "$BSKY_CRUNCHYROLL_HANDLE" \ + "$TWITTER_CRUNCHY_EMAIL" \ + "$BSKY_CRUNCHYROLL_APP_PASSWORD" + ''' + } + } + } + } +} \ No newline at end of file