3CatTw Jenkinsfile

This commit is contained in:
2026-04-14 19:29:09 +00:00
parent 300d45192c
commit 3fc74cb008

View File

@@ -2,7 +2,7 @@ pipeline {
agent any
options {
timeout(time: 15, unit: 'MINUTES')
timeout(time: 20, unit: 'MINUTES')
timestamps()
buildDiscarder(logRotator(numToKeepStr: '10'))
disableConcurrentBuilds()
@@ -12,10 +12,15 @@ pipeline {
cron('H/30 * * * *')
}
environment {
VENV_DIR = 'venv'
PIP_CACHE_DIR = "${WORKSPACE}/.pip-cache"
PYTHONUNBUFFERED = '1'
}
stages {
stage('Checkout Code') {
steps {
// Pulls the code from the repository where this Jenkinsfile lives
checkout scm
}
}
@@ -23,27 +28,35 @@ pipeline {
stage('Setup Python & Install Dependencies') {
steps {
sh '''
set -e # Exit immediately if a command exits with a non-zero status
set -euxo pipefail
# Create a virtual environment named 'venv'
python3 -m venv venv
python3 -m venv "${VENV_DIR}"
# 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
# Always use venv python explicitly
"${VENV_DIR}/bin/python" -m pip install --upgrade pip wheel setuptools
# Check if moviepy is installed
pip list | grep moviepy || { echo 'MoviePy installation failed!'; exit 1; }
"${VENV_DIR}/bin/pip" install --cache-dir "${PIP_CACHE_DIR}" -U \
atproto \
tweety-ns \
playwright \
httpx \
arrow \
python-dotenv \
moviepy \
fastfeedparser \
beautifulsoup4 \
charset-normalizer \
Pillow
# Check if FFmpeg is installed
ffmpeg -version || { echo 'FFmpeg is not installed!'; exit 1; }
# Verify required imports
"${VENV_DIR}/bin/python" -c "import fastfeedparser; print('fastfeedparser OK')"
"${VENV_DIR}/bin/python" -c "import moviepy; print('moviepy OK')"
# Verify that moviepy can be imported
python3 -c "import moviepy" || { echo 'MoviePy import failed!'; exit 1; }
# Check FFmpeg
ffmpeg -version
# Install the local browser binaries for this environment
playwright install chromium
# Install Playwright browser binaries in this workspace environment
"${VENV_DIR}/bin/python" -m playwright install chromium
'''
}
}