Add launch pipeline and idea marketplace seed commands
This commit is contained in:
54
Jenkinsfile
vendored
54
Jenkinsfile
vendored
@@ -6,13 +6,19 @@ pipeline {
|
||||
disableConcurrentBuilds()
|
||||
skipDefaultCheckout(true)
|
||||
}
|
||||
parameters {
|
||||
booleanParam(
|
||||
name: 'RUN_DEMO_PURGE',
|
||||
defaultValue: false,
|
||||
description: 'Run a one-time demo catalogue purge before the normal idea marketplace seed and launch prep.'
|
||||
)
|
||||
}
|
||||
environment {
|
||||
PYENVPIPELINE_VIRTUALENV = '1'
|
||||
GIT_SSH_COMMAND = 'ssh -o StrictHostKeyChecking=accept-new'
|
||||
STAGING_AUDIT_HOST = 'root@49.12.204.96'
|
||||
STAGING_AUDIT_PROJECT_NAME = 'mandelstudio'
|
||||
STAGING_AUDIT_PROJECT_DIR = '/home/www-mandelstudio/mandelstudio'
|
||||
STAGING_AUDIT_MANAGE = '/var/lib/virtualenv/mandelstudio/bin/manage.py'
|
||||
STAGING_AUDIT_SSH_CREDENTIALS_ID = 'staging-root-ssh'
|
||||
}
|
||||
|
||||
stages {
|
||||
@@ -36,6 +42,30 @@ pipeline {
|
||||
stage('Build') {
|
||||
steps {
|
||||
sh '''
|
||||
STABLE_INDEX_URL=${STABLE_INDEX_URL:-https://pypi.mandelblog.com/mandel/stable/+simple/}
|
||||
TESTING_INDEX_URL=${TESTING_INDEX_URL:-https://pypi.mandelblog.com/mandel/testing/+simple/}
|
||||
ROOT_INDEX_URL=${PIP_EXTRA_INDEX_URL:-https://pypi.mandelblog.com/root/pypi/+simple/}
|
||||
export STABLE_INDEX_URL
|
||||
if python3 - <<'PY'
|
||||
import os
|
||||
import sys
|
||||
from urllib.request import Request, urlopen
|
||||
from urllib.error import URLError, HTTPError
|
||||
url = os.environ["STABLE_INDEX_URL"]
|
||||
try:
|
||||
req = Request(url, method='HEAD')
|
||||
with urlopen(req, timeout=10) as response:
|
||||
sys.exit(0 if response.status < 400 else 1)
|
||||
except HTTPError as exc:
|
||||
sys.exit(0 if exc.code < 400 else 1)
|
||||
except URLError:
|
||||
sys.exit(1)
|
||||
PY
|
||||
then
|
||||
echo "devpi stable index available, but stable-first install is not enabled yet"
|
||||
else
|
||||
echo "devpi stable index not available, using testing as production source"
|
||||
fi
|
||||
if command -v sudo >/dev/null 2>&1 && sudo -n true >/dev/null 2>&1; then
|
||||
sudo apt-get update -y
|
||||
sudo apt-get install -y python3-venv python3-pip make build-essential libpq-dev \
|
||||
@@ -52,14 +82,20 @@ pipeline {
|
||||
. .venv/bin/activate
|
||||
pip install coverage
|
||||
pip install --upgrade pip "setuptools==69.5.1" wheel
|
||||
PIP_INDEX_URL=${PIP_INDEX_URL:-https://pypi.mandelblog.com/mandel/testing/+simple/} \
|
||||
PIP_EXTRA_INDEX_URL=${PIP_EXTRA_INDEX_URL:-https://pypi.mandelblog.com/root/pypi/+simple/} \
|
||||
PIP_INDEX_URL="$TESTING_INDEX_URL" \
|
||||
PIP_EXTRA_INDEX_URL="$ROOT_INDEX_URL" \
|
||||
pip install --no-build-isolation --pre --editable . setuptools wheel --upgrade --upgrade-strategy=eager --use-deprecated=legacy-resolver
|
||||
cp "${JOB_BASE_NAME}/ocyan.json" "${JOB_BASE_NAME}/${JOB_BASE_NAME}.json"
|
||||
pip install ruff vdt.versionplugin.wheel
|
||||
pip install --upgrade "setuptools==69.5.1" wheel
|
||||
python3 scripts/validate_payment_provider_config.py
|
||||
manage.py migrate --no-input --skip-checks
|
||||
manage.py purge_demo_data
|
||||
if [ "${RUN_DEMO_PURGE}" = "true" ]; then
|
||||
manage.py purge_demo_data
|
||||
fi
|
||||
manage.py seed_idea_marketplace
|
||||
manage.py prepare_idea_marketplace_launch --apply-homepage-copy --purge-demo-pages
|
||||
manage.py validate_idea_marketplace_launch
|
||||
manage.py collectstatic --no-input --verbosity=0
|
||||
pip install "httpx<0.28"
|
||||
'''
|
||||
@@ -105,10 +141,10 @@ pipeline {
|
||||
timeout(time: 10, unit: 'MINUTES')
|
||||
}
|
||||
steps {
|
||||
sh 'mkdir -p artifacts'
|
||||
withCredentials([sshUserPrivateKey(credentialsId: env.STAGING_AUDIT_SSH_CREDENTIALS_ID, keyFileVariable: 'STAGING_SSH_KEYFILE')]) {
|
||||
sh './scripts/run_remote_multilingual_audit.sh'
|
||||
}
|
||||
deleteDir()
|
||||
checkout scm
|
||||
sh 'mkdir -p artifacts && chmod +x scripts/run_remote_multilingual_audit.sh'
|
||||
sh './scripts/run_remote_multilingual_audit.sh'
|
||||
script {
|
||||
int status = sh(script: 'python3 scripts/multilingual_audit_ci.py --json artifacts/multilingual-audit.json', returnStatus: true)
|
||||
if (status == 2) {
|
||||
|
||||
Reference in New Issue
Block a user