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 agent any
options { options {
timeout(time: 15, unit: 'MINUTES') timeout(time: 20, unit: 'MINUTES')
timestamps() timestamps()
buildDiscarder(logRotator(numToKeepStr: '10')) buildDiscarder(logRotator(numToKeepStr: '10'))
disableConcurrentBuilds() disableConcurrentBuilds()
@@ -12,10 +12,15 @@ pipeline {
cron('H/30 * * * *') cron('H/30 * * * *')
} }
environment {
VENV_DIR = 'venv'
PIP_CACHE_DIR = "${WORKSPACE}/.pip-cache"
PYTHONUNBUFFERED = '1'
}
stages { stages {
stage('Checkout Code') { stage('Checkout Code') {
steps { steps {
// Pulls the code from the repository where this Jenkinsfile lives
checkout scm checkout scm
} }
} }
@@ -23,27 +28,35 @@ pipeline {
stage('Setup Python & Install Dependencies') { stage('Setup Python & Install Dependencies') {
steps { steps {
sh ''' 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
# 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
# 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; }
# Verify that moviepy can be imported python3 -m venv "${VENV_DIR}"
python3 -c "import moviepy" || { echo 'MoviePy import failed!'; exit 1; }
# Install the local browser binaries for this environment # Always use venv python explicitly
playwright install chromium "${VENV_DIR}/bin/python" -m pip install --upgrade pip wheel setuptools
"${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
# Verify required imports
"${VENV_DIR}/bin/python" -c "import fastfeedparser; print('fastfeedparser OK')"
"${VENV_DIR}/bin/python" -c "import moviepy; print('moviepy OK')"
# Check FFmpeg
ffmpeg -version
# Install Playwright browser binaries in this workspace environment
"${VENV_DIR}/bin/python" -m playwright install chromium
''' '''
} }
} }