diff --git a/jenkins/comedygoldbcnTw b/jenkins/comedygoldbcnTw index f7e8f2e..86585c9 100644 --- a/jenkins/comedygoldbcnTw +++ b/jenkins/comedygoldbcnTw @@ -23,69 +23,31 @@ pipeline { stage('Setup Python & Install Dependencies') { steps { sh ''' - set -e + 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; } - # ── Create venv ──────────────────────────────────── - python3 -m venv venv + # Verify that moviepy can be imported + python3 -c "import moviepy" || { echo 'MoviePy import failed!'; exit 1; } - # ── 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 + # Install the local browser binaries for this environment + playwright install chromium ''' } } - stage('Run Script') { steps { // Securely injects Jenkins credentials as environment variables