91 lines
3.0 KiB
Plaintext
91 lines
3.0 KiB
Plaintext
pipeline {
|
|
agent any
|
|
|
|
options {
|
|
timeout(time: 20, unit: 'MINUTES')
|
|
timestamps()
|
|
buildDiscarder(logRotator(numToKeepStr: '10'))
|
|
disableConcurrentBuilds()
|
|
}
|
|
|
|
triggers {
|
|
cron('H/30 * * * *')
|
|
}
|
|
|
|
stages {
|
|
|
|
stage('Checkout Code') {
|
|
steps {
|
|
checkout scm
|
|
}
|
|
}
|
|
|
|
stage('Setup Python & Install Dependencies') {
|
|
steps {
|
|
sh '''
|
|
set -e
|
|
cd "$WORKSPACE"
|
|
|
|
# Crea el venv
|
|
python3 -m venv venv
|
|
|
|
# Usa sempre python3 -m pip, mai el binari pip directament
|
|
"$WORKSPACE/venv/bin/python3" -m pip install --upgrade pip wheel setuptools
|
|
|
|
"$WORKSPACE/venv/bin/python3" -m pip install -U \
|
|
atproto \
|
|
playwright \
|
|
playwright-stealth \
|
|
httpx \
|
|
arrow \
|
|
python-dotenv \
|
|
moviepy \
|
|
beautifulsoup4 \
|
|
charset-normalizer \
|
|
Pillow \
|
|
grapheme \
|
|
yt-dlp \
|
|
curl-cffi
|
|
|
|
# Sanity checks
|
|
"$WORKSPACE/venv/bin/python3" -c "import atproto; print('atproto OK')"
|
|
"$WORKSPACE/venv/bin/python3" -c "import playwright; print('playwright OK')"
|
|
"$WORKSPACE/venv/bin/python3" -c "import yt_dlp; print('yt_dlp OK')"
|
|
"$WORKSPACE/venv/bin/python3" -c "import curl_cffi; print('curl_cffi OK')"
|
|
|
|
# Playwright browser binaries
|
|
PLAYWRIGHT_BROWSERS_PATH=/var/jenkins_home/.playwright-browsers \
|
|
"$WORKSPACE/venv/bin/python3" -m playwright install chromium
|
|
'''
|
|
}
|
|
}
|
|
|
|
// ─────────────────────────────────────────────
|
|
// Post actions
|
|
// ─────────────────────────────────────────────
|
|
post {
|
|
|
|
always {
|
|
// Archive logs, state, and any debug screenshots
|
|
archiveArtifacts(
|
|
artifacts: '*.log, *.json, screenshot_*.png',
|
|
allowEmptyArchive: true
|
|
)
|
|
|
|
// Remove injected cookies file — never leave on disk between runs
|
|
sh 'rm -f tiktok_cookies.json || true'
|
|
}
|
|
|
|
success {
|
|
echo '✅ TikTok→Bluesky sync completed successfully.'
|
|
}
|
|
|
|
failure {
|
|
echo '❌ TikTok→Bluesky sync failed — check archived logs and screenshots.'
|
|
}
|
|
|
|
unstable {
|
|
echo '⚠️ TikTok→Bluesky sync finished with warnings.'
|
|
}
|
|
}
|
|
} |