3CatTw Jenkinsfile
This commit is contained in:
@@ -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_DIR}"
|
||||||
python3 -m venv venv
|
|
||||||
|
|
||||||
# Activate the virtual environment and install dependencies
|
# Always use venv python explicitly
|
||||||
. venv/bin/activate && \
|
"${VENV_DIR}/bin/python" -m pip install --upgrade pip wheel setuptools
|
||||||
pip install --upgrade pip && \
|
|
||||||
pip install -U atproto tweety-ns playwright httpx arrow python-dotenv moviepy
|
|
||||||
|
|
||||||
# Check if moviepy is installed
|
"${VENV_DIR}/bin/pip" install --cache-dir "${PIP_CACHE_DIR}" -U \
|
||||||
pip list | grep moviepy || { echo 'MoviePy installation failed!'; exit 1; }
|
atproto \
|
||||||
|
tweety-ns \
|
||||||
|
playwright \
|
||||||
|
httpx \
|
||||||
|
arrow \
|
||||||
|
python-dotenv \
|
||||||
|
moviepy \
|
||||||
|
fastfeedparser \
|
||||||
|
beautifulsoup4 \
|
||||||
|
charset-normalizer \
|
||||||
|
Pillow
|
||||||
|
|
||||||
# Check if FFmpeg is installed
|
# Verify required imports
|
||||||
ffmpeg -version || { echo 'FFmpeg is not installed!'; exit 1; }
|
"${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
|
# Check FFmpeg
|
||||||
python3 -c "import moviepy" || { echo 'MoviePy import failed!'; exit 1; }
|
ffmpeg -version
|
||||||
|
|
||||||
# Install the local browser binaries for this environment
|
# Install Playwright browser binaries in this workspace environment
|
||||||
playwright install chromium
|
"${VENV_DIR}/bin/python" -m playwright install chromium
|
||||||
'''
|
'''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user