Bot de JijantesFC
This commit is contained in:
99
jenkins/jijantesFC
Normal file
99
jenkins/jijantesFC
Normal file
@@ -0,0 +1,99 @@
|
||||
pipeline {
|
||||
agent any
|
||||
|
||||
options {
|
||||
timeout(time: 20, unit: 'MINUTES')
|
||||
timestamps()
|
||||
buildDiscarder(logRotator(numToKeepStr: '10'))
|
||||
disableConcurrentBuilds()
|
||||
}
|
||||
|
||||
triggers {
|
||||
cron('H/30 * * * *')
|
||||
}
|
||||
|
||||
environment {
|
||||
VENV_DIR = 'venv'
|
||||
PIP_CACHE_DIR = "${WORKSPACE}/.pip-cache"
|
||||
PYTHONUNBUFFERED = '1'
|
||||
}
|
||||
|
||||
stages {
|
||||
stage('Checkout Code') {
|
||||
steps {
|
||||
checkout scm
|
||||
}
|
||||
}
|
||||
|
||||
stage('Setup Python & Install Dependencies') {
|
||||
steps {
|
||||
sh '''
|
||||
set -euxo pipefail
|
||||
|
||||
python3 -m venv "${VENV_DIR}"
|
||||
|
||||
# Always use venv python explicitly
|
||||
"${VENV_DIR}/bin/python" -m pip install --upgrade pip wheel setuptools
|
||||
|
||||
"${VENV_DIR}/bin/pip" install --cache-dir "${PIP_CACHE_DIR}" -U \
|
||||
atproto \
|
||||
tweety-ns \
|
||||
playwright \
|
||||
httpx \
|
||||
arrow \
|
||||
python-dotenv \
|
||||
moviepy \
|
||||
fastfeedparser \
|
||||
beautifulsoup4 \
|
||||
charset-normalizer \
|
||||
Pillow \
|
||||
grapheme
|
||||
|
||||
# Verify required imports
|
||||
"${VENV_DIR}/bin/python" -c "import fastfeedparser; print('fastfeedparser OK')"
|
||||
"${VENV_DIR}/bin/python" -c "import moviepy; print('moviepy OK')"
|
||||
|
||||
# Check FFmpeg
|
||||
ffmpeg -version
|
||||
|
||||
# Install Playwright browser binaries in this workspace environment
|
||||
"${VENV_DIR}/bin/python" -m playwright install chromium
|
||||
'''
|
||||
}
|
||||
}
|
||||
|
||||
stage('Run Script') {
|
||||
steps {
|
||||
withCredentials([
|
||||
string(credentialsId: 'TWITTER_USERNAME', variable: 'TWITTER_USERNAME'),
|
||||
string(credentialsId: 'TWITTER_PASSWORD', variable: 'TWITTER_PASSWORD'),
|
||||
string(credentialsId: 'TWITTER_JIJANTESFC_EMAIL', variable: 'TWITTER_JIJANTESFC_EMAIL'),
|
||||
string(credentialsId: 'TWITTER_JIJANTESFC_HANDLE', variable: 'TWITTER_JIJANTESFC_HANDLE'),
|
||||
string(credentialsId: 'BSKY_JIJANTESFC_HANDLE', variable: 'BSKY_JIJANTESFC_HANDLE'),
|
||||
string(credentialsId: 'BSKY_JIJANTESFC_APP_PASSWORD', variable: 'BSKY_JIJANTESFC_APP_PASSWORD')
|
||||
]) {
|
||||
sh '''
|
||||
set -euxo pipefail
|
||||
|
||||
"${VENV_DIR}/bin/python" twitter2bsky.py \
|
||||
--twitter-username "$TWITTER_USERNAME" \
|
||||
--twitter-password "$TWITTER_PASSWORD" \
|
||||
--twitter-email "$TWITTER_JIJANTESFC_EMAIL" \
|
||||
--twitter-handle "$TWITTER_JIJANTESFC_HANDLE" \
|
||||
--bsky-handle "$BSKY_JIJANTESFC_HANDLE" \
|
||||
--bsky-password "$BSKY_JIJANTESFC_APP_PASSWORD" \
|
||||
--bsky-base-url https://eurosky.social \
|
||||
--bsky-langs es
|
||||
'''
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
post {
|
||||
always {
|
||||
// Optional: keep logs/artifacts if your script writes any
|
||||
archiveArtifacts artifacts: '*.log, *.json', allowEmptyArchive: true
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user