This commit is contained in:
Guillem Hernandez Sola
2026-05-19 12:31:15 +02:00
parent cb9e7a86f6
commit 6160ea5892
2 changed files with 89 additions and 35 deletions

View File

@@ -23,31 +23,69 @@ pipeline {
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 grapheme
# 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; }
set -e
# Verify that moviepy can be imported
python3 -c "import moviepy" || { echo 'MoviePy import failed!'; exit 1; }
# ── Create venv ────────────────────────────────────
python3 -m venv venv
# Install the local browser binaries for this environment
playwright install chromium
# ── Upgrade pip toolchain ──────────────────────────
. venv/bin/activate
pip install --upgrade pip wheel setuptools
# ── Core dependencies ──────────────────────────────
pip install -U \
atproto \
playwright \
playwright-stealth \
httpx \
arrow \
python-dotenv \
moviepy \
beautifulsoup4 \
charset-normalizer \
Pillow \
grapheme
# ── yt-dlp: always upgrade to latest ──────────────
pip install --upgrade yt-dlp
pip show yt-dlp | grep -E "^(Name|Version)"
# ── curl_cffi: TikTok impersonation support ────────
# Required by yt-dlp to bypass TikTok bot detection
pip install --upgrade curl-cffi
pip show curl-cffi | grep -E "^(Name|Version)"
# ── playwright-stealth version check ───────────────
pip show playwright-stealth | grep -E "^(Name|Version)"
python3 -c "
try:
from playwright_stealth import stealth_sync
print('playwright_stealth OK (v1.x - stealth_sync)')
except ImportError:
from playwright_stealth import Stealth
print('playwright_stealth OK (v2.x - Stealth class)')
"
# ── Sanity checks ──────────────────────────────────
python3 -c "import atproto; print('atproto OK')"
python3 -c "import playwright; print('playwright OK')"
python3 -c "import yt_dlp; print('yt_dlp OK')"
python3 -c "import curl_cffi; print('curl_cffi OK')"
python3 -c "import httpx; print('httpx OK')"
python3 -c "import arrow; print('arrow OK')"
python3 -c "import moviepy; print('moviepy OK')"
# ── System tools ───────────────────────────────────
ffmpeg -version | head -1
ffprobe -version | head -1
# ── Playwright browser binaries ────────────────────
playwright install chromium
'''
}
}
stage('Run Script') {
steps {
// Securely injects Jenkins credentials as environment variables