Fixed Jenkinsfile
This commit is contained in:
@@ -12,12 +12,6 @@ pipeline {
|
|||||||
cron('H/30 * * * *')
|
cron('H/30 * * * *')
|
||||||
}
|
}
|
||||||
|
|
||||||
environment {
|
|
||||||
VENV_DIR = 'venv'
|
|
||||||
PIP_CACHE_DIR = "${WORKSPACE}/.pip-cache"
|
|
||||||
PYTHONUNBUFFERED = '1'
|
|
||||||
}
|
|
||||||
|
|
||||||
stages {
|
stages {
|
||||||
|
|
||||||
// ─────────────────────────────────────────────
|
// ─────────────────────────────────────────────
|
||||||
@@ -35,27 +29,20 @@ pipeline {
|
|||||||
stage('Setup Python & Install Dependencies') {
|
stage('Setup Python & Install Dependencies') {
|
||||||
steps {
|
steps {
|
||||||
sh '''
|
sh '''
|
||||||
set -euxo pipefail
|
set -e
|
||||||
|
|
||||||
# ── Playwright system dependencies (required in CI) ─
|
|
||||||
# Installs libglib, libnss, libatk, libdrm, etc.
|
|
||||||
# Safe to run even if already installed — exits 0.
|
|
||||||
"${VENV_DIR}/bin/python" -m playwright install-deps chromium || \
|
|
||||||
sudo playwright install-deps chromium || \
|
|
||||||
echo "⚠️ playwright install-deps skipped (no sudo) — continuing"
|
|
||||||
|
|
||||||
# ── Create venv ────────────────────────────────────
|
# ── Create venv ────────────────────────────────────
|
||||||
python3 -m venv "${VENV_DIR}"
|
python3 -m venv venv
|
||||||
|
|
||||||
# ── Upgrade pip toolchain ──────────────────────────
|
# ── Upgrade pip toolchain ──────────────────────────
|
||||||
"${VENV_DIR}/bin/python" -m pip install --upgrade pip wheel setuptools
|
. venv/bin/activate
|
||||||
|
pip install --upgrade pip wheel setuptools
|
||||||
|
|
||||||
# ── Install all required packages ──────────────────
|
# ── Core dependencies ──────────────────────────────
|
||||||
"${VENV_DIR}/bin/pip" install \
|
pip install -U \
|
||||||
--cache-dir "${PIP_CACHE_DIR}" \
|
|
||||||
-U \
|
|
||||||
atproto \
|
atproto \
|
||||||
playwright \
|
playwright \
|
||||||
|
playwright-stealth \
|
||||||
httpx \
|
httpx \
|
||||||
arrow \
|
arrow \
|
||||||
python-dotenv \
|
python-dotenv \
|
||||||
@@ -67,24 +54,18 @@ pipeline {
|
|||||||
|
|
||||||
# ── yt-dlp: always upgrade to latest ──────────────
|
# ── yt-dlp: always upgrade to latest ──────────────
|
||||||
# TikTok extractor breaks frequently — latest is required
|
# TikTok extractor breaks frequently — latest is required
|
||||||
"${VENV_DIR}/bin/pip" install \
|
pip install --upgrade yt-dlp
|
||||||
--cache-dir "${PIP_CACHE_DIR}" \
|
pip show yt-dlp | grep -E "^(Name|Version)"
|
||||||
--upgrade \
|
|
||||||
"yt-dlp"
|
|
||||||
|
|
||||||
# Print installed yt-dlp version for traceability
|
# ── curl_cffi: TikTok impersonation (REQUIRED) ─────
|
||||||
"${VENV_DIR}/bin/pip" show yt-dlp | grep -E "^(Name|Version)"
|
# Without this yt-dlp cannot bypass TikTok bot detection
|
||||||
|
pip install --upgrade curl-cffi
|
||||||
|
pip show curl-cffi | grep -E "^(Name|Version)"
|
||||||
|
python3 -c "import curl_cffi; print('curl_cffi OK')"
|
||||||
|
|
||||||
# ── playwright-stealth ─────────────────────────────
|
# ── playwright-stealth version check ───────────────
|
||||||
"${VENV_DIR}/bin/pip" install \
|
pip show playwright-stealth | grep -E "^(Name|Version)"
|
||||||
--cache-dir "${PIP_CACHE_DIR}" \
|
python3 -c "
|
||||||
-U playwright-stealth
|
|
||||||
|
|
||||||
# Print which version was installed for traceability
|
|
||||||
"${VENV_DIR}/bin/pip" show playwright-stealth | grep -E "^(Name|Version)"
|
|
||||||
|
|
||||||
# Verify the stealth import works (handles both v1 and v2)
|
|
||||||
"${VENV_DIR}/bin/python" -c "
|
|
||||||
try:
|
try:
|
||||||
from playwright_stealth import stealth_sync
|
from playwright_stealth import stealth_sync
|
||||||
print('playwright_stealth OK (v1.x - stealth_sync)')
|
print('playwright_stealth OK (v1.x - stealth_sync)')
|
||||||
@@ -94,19 +75,19 @@ except ImportError:
|
|||||||
"
|
"
|
||||||
|
|
||||||
# ── Sanity checks ──────────────────────────────────
|
# ── Sanity checks ──────────────────────────────────
|
||||||
"${VENV_DIR}/bin/python" -c "import atproto; print('atproto OK')"
|
python3 -c "import atproto; print('atproto OK')"
|
||||||
"${VENV_DIR}/bin/python" -c "import playwright; print('playwright OK')"
|
python3 -c "import playwright; print('playwright OK')"
|
||||||
"${VENV_DIR}/bin/python" -c "import yt_dlp; print('yt_dlp OK')"
|
python3 -c "import yt_dlp; print('yt_dlp OK')"
|
||||||
"${VENV_DIR}/bin/python" -c "import httpx; print('httpx OK')"
|
python3 -c "import httpx; print('httpx OK')"
|
||||||
"${VENV_DIR}/bin/python" -c "import arrow; print('arrow OK')"
|
python3 -c "import arrow; print('arrow OK')"
|
||||||
"${VENV_DIR}/bin/python" -c "import moviepy; print('moviepy OK')"
|
python3 -c "import moviepy; print('moviepy OK')"
|
||||||
|
|
||||||
# ── System tools ───────────────────────────────────
|
# ── System tools ───────────────────────────────────
|
||||||
ffmpeg -version | head -1
|
ffmpeg -version | head -1
|
||||||
ffprobe -version | head -1
|
ffprobe -version | head -1
|
||||||
|
|
||||||
# ── Playwright browser binaries ────────────────────
|
# ── Playwright browser binaries ────────────────────
|
||||||
"${VENV_DIR}/bin/python" -m playwright install chromium
|
playwright install chromium
|
||||||
'''
|
'''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user