3CatTw Jenkinsfile
This commit is contained in:
@@ -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
|
||||
|
||||
# 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; }
|
||||
set -euxo pipefail
|
||||
|
||||
# Verify that moviepy can be imported
|
||||
python3 -c "import moviepy" || { echo 'MoviePy import failed!'; exit 1; }
|
||||
python3 -m venv "${VENV_DIR}"
|
||||
|
||||
# Install the local browser binaries for this environment
|
||||
playwright install chromium
|
||||
# Always use venv python explicitly
|
||||
"${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
|
||||
'''
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user