Add multilingual audit CI pipeline + extract mandelblog_content_guard
This commit is contained in:
62
Jenkinsfile.multilingual-nightly
Normal file
62
Jenkinsfile.multilingual-nightly
Normal file
@@ -0,0 +1,62 @@
|
||||
#!/usr/bin/env groovy
|
||||
|
||||
pipeline {
|
||||
agent { label 'external_pool' }
|
||||
triggers {
|
||||
cron('H 2 * * *')
|
||||
}
|
||||
options {
|
||||
disableConcurrentBuilds()
|
||||
skipDefaultCheckout(true)
|
||||
}
|
||||
environment {
|
||||
STAGING_AUDIT_HOST = 'root@49.12.204.96'
|
||||
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 {
|
||||
stage('Checkout') {
|
||||
steps {
|
||||
withCredentials([sshUserPrivateKey(credentialsId: 'gitea-ssh', keyFileVariable: 'GIT_KEYFILE')]) {
|
||||
sh '''
|
||||
export GIT_SSH_COMMAND="ssh -i $GIT_KEYFILE -o StrictHostKeyChecking=accept-new"
|
||||
if [ -d .git ]; then
|
||||
git remote set-url origin ssh://git@git.mandelblog.com:2222/salt/mandelstudio.git
|
||||
git fetch --tags --force --progress origin +refs/heads/master:refs/remotes/origin/master
|
||||
else
|
||||
git clone ssh://git@git.mandelblog.com:2222/salt/mandelstudio.git .
|
||||
git fetch --tags --force --progress origin +refs/heads/master:refs/remotes/origin/master
|
||||
fi
|
||||
git checkout -f refs/remotes/origin/master
|
||||
'''
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Nightly Multilingual Audit') {
|
||||
options {
|
||||
timeout(time: 10, unit: 'MINUTES')
|
||||
}
|
||||
steps {
|
||||
sh 'mkdir -p artifacts && [ -f artifacts/multilingual-audit.json ] && cp artifacts/multilingual-audit.json artifacts/previous-multilingual-audit.json || true'
|
||||
withCredentials([sshUserPrivateKey(credentialsId: env.STAGING_AUDIT_SSH_CREDENTIALS_ID, keyFileVariable: 'STAGING_SSH_KEYFILE')]) {
|
||||
sh './scripts/run_remote_multilingual_audit.sh'
|
||||
}
|
||||
script {
|
||||
int status = sh(script: 'python3 scripts/multilingual_audit_ci.py --json artifacts/multilingual-audit.json --previous-json artifacts/previous-multilingual-audit.json', returnStatus: true)
|
||||
if (status == 2) {
|
||||
error('Block-level multilingual issues detected or audit execution failed.')
|
||||
}
|
||||
if (status == 1) {
|
||||
unstable('Warn-level multilingual issues detected.')
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
archiveArtifacts artifacts: 'artifacts/multilingual-audit.json,artifacts/previous-multilingual-audit.json', onlyIfSuccessful: false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user