This commit is contained in:
Guillem Hernandez Sola
2026-06-30 16:15:29 +02:00
parent 9354c99f00
commit 7077ad4adb
35 changed files with 1168 additions and 708 deletions

View File

@@ -2,7 +2,7 @@ pipeline {
agent any
options {
timeout(time: 20, unit: 'MINUTES')
timeout(time: 15, unit: 'MINUTES')
timestamps()
buildDiscarder(logRotator(numToKeepStr: '10'))
disableConcurrentBuilds()
@@ -12,13 +12,8 @@ pipeline {
cron('H/30 * * * *')
}
environment {
VENV_DIR = 'venv'
PIP_CACHE_DIR = "${WORKSPACE}/.pip-cache"
PYTHONUNBUFFERED = '1'
}
stages {
stage('Checkout Code') {
steps {
checkout scm
@@ -28,14 +23,16 @@ pipeline {
stage('Setup Python & Install Dependencies') {
steps {
sh '''
set -euxo pipefail
set -e
cd "$WORKSPACE"
python3 -m venv "${VENV_DIR}"
# Crea el venv
python3 -m venv venv
# Always use venv python explicitly
"${VENV_DIR}/bin/python" -m pip install --upgrade pip wheel setuptools
# Usa python3 -m pip per evitar problemes de shebang amb sh/dash
"$WORKSPACE/venv/bin/python3" -m pip install --upgrade pip wheel setuptools
"${VENV_DIR}/bin/pip" install --cache-dir "${PIP_CACHE_DIR}" -U \
"$WORKSPACE/venv/bin/python3" -m pip install -U \
atproto \
tweety-ns \
playwright \
@@ -43,21 +40,24 @@ pipeline {
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')"
# Verificació moviepy
"$WORKSPACE/venv/bin/python3" -m pip list | grep moviepy \
|| { echo 'MoviePy installation failed!'; exit 1; }
# Check FFmpeg
ffmpeg -version
# Verificació FFmpeg
ffmpeg -version \
|| { echo 'FFmpeg is not installed!'; exit 1; }
# Install Playwright browser binaries in this workspace environment
"${VENV_DIR}/bin/python" -m playwright install chromium
# Verificació imports
"$WORKSPACE/venv/bin/python3" -c "import moviepy; print('moviepy OK')"
"$WORKSPACE/venv/bin/python3" -c "import atproto; print('atproto OK')"
"$WORKSPACE/venv/bin/python3" -c "import playwright; print('playwright OK')"
# Instal·lació binaris Playwright
PLAYWRIGHT_BROWSERS_PATH=/var/jenkins_home/.playwright-browsers \
"$WORKSPACE/venv/bin/python3" -m playwright install chromium
'''
}
}