beffroi-reporting/Jenkinsfile

213 lines
5.9 KiB
Groovy

// Add this webhook in Gitea:
// http://192.168.1.37:8080/gitea-webhook/post
pipeline {
agent { label 'rust_no_docker' }
options { disableConcurrentBuilds() }
environment {
CARGO_TERM_COLOR = 'always'
CI_ARTIFACT_DIR = '.ci-artifacts'
// Reserved for future report publication.
// DEPLOY_DIR = '/mnt/books/Reports'
// Reserved for future generated diagnostic/report metadata.
// DIAGNOSTICS_AUTHOR = 'Beffroi'
}
stages {
stage('Checkout') {
steps {
checkout scm
sh '''
set -eu
echo "Synchronizing Beffroi Reporting workspace..."
git submodule sync --recursive
git submodule update --init --recursive
'''
}
}
stage('Validate Workspace') {
steps {
sh '''
set -eu
echo "Validating macro repository..."
test -f README.md
test -f LICENSE
test -f LICENSE-DATA.md
test -f AGENT.md
test -f AGENTS-TASKS.md
test -f .gitmodules
echo
echo "Submodules:"
git submodule status --recursive
echo
echo "Workspace structure OK."
'''
}
}
stage('Validate Components') {
steps {
sh '''
set -eu
echo "Checking component repositories..."
test -d diagnostics/.git || test -f diagnostics/.git
test -d reports/.git || test -f reports/.git
test -d reporter/.git || test -f reporter/.git
test -f diagnostics/README.md
test -f reports/README.md
test -f reporter/README.md
echo "Component repositories OK."
'''
}
}
/*
* Legacy references
* -----------------
*
* During migration, references/WinDiagnostics and
* references/typst_reporter may also be submodules.
*
* They are migration references and should NOT become runtime
* dependencies of the final architecture.
*
* We therefore intentionally do not require them here forever.
*/
/*
* TODO: Component CI
*
* Once component-level validation commands exist, invoke them
* here rather than duplicating their implementation.
*
* For example:
*
* diagnostics/... validate
* reporter/... validate
* reports/... validate
*/
/*
* TODO: Integration Test
*
* Eventually validate the complete sanitized pipeline:
*
* diagnostic fixture
* ↓
* win-diagnostics
* ↓
* diagnostic.json
* ↓
* beffroi-reports adapter
* ↓
* report.yaml
* ↓
* reportist
* ↓
* report.pdf
*/
/*
* TODO: Setup Typst
*
* Install through cargo-binstall as in the legacy reporting CI
* once integration rendering exists.
*/
/*
* TODO: Setup Packaging
*
* The previous reporting project used:
*
* uv venv --allow-existing .ci-venv
* uv pip install ...
*
* Do not migrate this until packaging is actually needed.
*/
/*
* TODO: Render Reports
*
* Rendering should use Reportist against report definitions owned
* by beffroi-reports.
*/
/*
* TODO: Package Reports
*
* If encrypted report archives remain useful, migrate the existing
* pyzipper-based packaging here after the new pipeline works.
*/
/*
* TODO: Publish Reports
*
* Potential future destination:
*
* /mnt/books/Reports
*
* Do not enable publication until generated output has been
* manually compared with the existing production reports.
*/
}
post {
success {
publishChecks(
conclusion: 'SUCCESS',
name: 'Beffroi Reporting CI',
summary: 'Beffroi Reporting workspace passed all currently implemented CI checks.',
text: 'The macro repository and its component submodules were checked out and validated successfully.',
title: 'Reporting workspace healthy'
)
echo '✅ Beffroi Reporting workspace is healthy.'
}
failure {
publishChecks(
conclusion: 'FAILURE',
name: 'Beffroi Reporting CI',
summary: 'Beffroi Reporting integration CI failed.',
text: 'Workspace checkout, submodule initialization, or validation failed. Check the Jenkins log.',
title: 'Reporting workspace failed'
)
echo '❌ Beffroi Reporting integration CI failed.'
}
unstable {
publishChecks(
conclusion: 'ACTION_REQUIRED',
name: 'Beffroi Reporting CI',
summary: 'Beffroi Reporting integration CI is unstable.',
text: 'The Jenkins build completed with an unstable status.',
title: 'Reporting workspace unstable'
)
echo '⚠️ Beffroi Reporting integration CI is unstable.'
}
always {
echo 'CI finished.'
}
}
}