ci: build and publish encrypted report archives
Beffroi Reporting CI A component or integration check failed.
Beffroi/beffroi-reporting/pipeline/head There was a failure building this commit
Details
Beffroi Reporting CI A component or integration check failed.
Beffroi/beffroi-reporting/pipeline/head There was a failure building this commit
Details
This commit is contained in:
parent
ea843f2f6f
commit
9d4e3f9f6e
|
|
@ -6,6 +6,13 @@ pipeline {
|
|||
skipDefaultCheckout(true)
|
||||
}
|
||||
|
||||
environment {
|
||||
CI_REPORT_DIR = '.ci-publication'
|
||||
CI_ARTIFACT_DIR = '.ci-artifacts'
|
||||
DEPLOY_DIR = '/mnt/books/Reports'
|
||||
DIAGNOSTICS_AUTHOR = 'Beffroi'
|
||||
}
|
||||
|
||||
stages {
|
||||
stage('Checkout') {
|
||||
steps {
|
||||
|
|
@ -31,6 +38,44 @@ pipeline {
|
|||
sh 'scripts/check-components.sh'
|
||||
}
|
||||
}
|
||||
|
||||
stage('Build Reports') {
|
||||
steps {
|
||||
sh '''
|
||||
set -eu
|
||||
rm -rf "${CI_REPORT_DIR}" "${CI_ARTIFACT_DIR}"
|
||||
scripts/build-publication.sh "${CI_REPORT_DIR}"
|
||||
'''
|
||||
}
|
||||
}
|
||||
|
||||
stage('Package Reports') {
|
||||
environment {
|
||||
REPORT_ZIP_PASSWORD = credentials('typst-reporter-publish-password')
|
||||
}
|
||||
steps {
|
||||
sh '''
|
||||
set +x
|
||||
set -eu
|
||||
scripts/package-reports.sh "${CI_REPORT_DIR}" "${CI_ARTIFACT_DIR}"
|
||||
'''
|
||||
archiveArtifacts artifacts: '.ci-artifacts/*.zip.enc', fingerprint: true
|
||||
}
|
||||
}
|
||||
|
||||
stage('Publish Reports') {
|
||||
when { branch 'main' }
|
||||
steps {
|
||||
sh '''
|
||||
set -eu
|
||||
mkdir -p "${DEPLOY_DIR}"
|
||||
for archive in Reports.zip.enc Diagnostics.zip.enc; do
|
||||
cp "${CI_ARTIFACT_DIR}/${archive}" "${DEPLOY_DIR}/.${archive}.tmp"
|
||||
mv -f "${DEPLOY_DIR}/.${archive}.tmp" "${DEPLOY_DIR}/${archive}"
|
||||
done
|
||||
'''
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
post {
|
||||
|
|
@ -38,9 +83,9 @@ pipeline {
|
|||
publishChecks(
|
||||
conclusion: 'SUCCESS',
|
||||
name: 'Beffroi Reporting CI',
|
||||
summary: 'All component and integration checks passed.',
|
||||
text: 'Diagnostic analysis, immutable draft generation, contract validation, and PDF rendering passed.',
|
||||
title: 'Beffroi Reporting CI passed'
|
||||
summary: 'All checks passed and encrypted report archives were built.',
|
||||
text: 'Validation, rendering, encrypted packaging, and main-branch publication completed successfully.',
|
||||
title: 'Beffroi reports published'
|
||||
)
|
||||
echo '✅ Beffroi Reporting CI passed.'
|
||||
}
|
||||
|
|
|
|||
23
README.md
23
README.md
|
|
@ -25,8 +25,7 @@ versions and high-level commands for the complete workflow.
|
|||
|
||||
## Requirements
|
||||
|
||||
The runtime uses Bash, Git, Typst 0.15 or newer, and Rust/Cargo. Cargo
|
||||
installs a small helper used for atomic, no-replace publication.
|
||||
The runtime uses Bash, Git, and Typst 0.15 or newer.
|
||||
Selected report fonts must also be installed; the examples use DejaVu Sans and
|
||||
DejaVu Sans Mono.
|
||||
|
||||
|
|
@ -95,6 +94,26 @@ scripts/workflow-all.sh CAPTURE_DIR EVIDENCE_ROOT OUTPUT_ROOT REFERENCE_TIME TIT
|
|||
This creates parallel `diagnostics`, `generations`, and `pdfs` trees beneath a
|
||||
new output root.
|
||||
|
||||
## Build publication archives
|
||||
|
||||
Build the preserved authored reports and diagnostic reports with:
|
||||
|
||||
```bash
|
||||
scripts/build-publication.sh /path/to/new-publication-directory
|
||||
```
|
||||
|
||||
Create password-encrypted publication artifacts with:
|
||||
|
||||
```bash
|
||||
REPORT_ZIP_PASSWORD='...' scripts/package-reports.sh \
|
||||
/path/to/publication-directory /path/to/artifacts
|
||||
```
|
||||
|
||||
The result contains `Reports.zip.enc` and `Diagnostics.zip.enc`, encrypted with
|
||||
AES-256-CBC and PBKDF2. Jenkins archives both files and publishes main-branch
|
||||
builds to `/mnt/books/Reports` using the
|
||||
`typst-reporter-publish-password` credential.
|
||||
|
||||
## Reproducibility
|
||||
|
||||
Git submodules pin exact component commits instead of following branch heads.
|
||||
|
|
|
|||
|
|
@ -13,12 +13,12 @@ elif [[ $# -ne 0 ]]; then
|
|||
fi
|
||||
|
||||
missing=()
|
||||
for command in git typst cargo; do
|
||||
for command in git typst; do
|
||||
command -v "$command" >/dev/null 2>&1 || missing+=("$command")
|
||||
done
|
||||
if ((${#missing[@]})); then
|
||||
echo "Missing required tools: ${missing[*]}" >&2
|
||||
echo 'Install Git, Typst, and Rust/Cargo, then rerun bootstrap.' >&2
|
||||
echo 'Install Git and Typst, then rerun bootstrap.' >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
|
@ -42,13 +42,10 @@ while IFS= read -r status; do
|
|||
done < <(git submodule status --recursive)
|
||||
git --version
|
||||
typst --version
|
||||
cargo --version
|
||||
|
||||
if $check_only; then
|
||||
echo 'Pinned components and required tools are available.'
|
||||
exit 0
|
||||
fi
|
||||
|
||||
reports/install.sh
|
||||
|
||||
echo 'Bootstrap complete. Run scripts/check-components.sh to verify the workspace.'
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ This invokes the component suites and a sanitized capture-to-PDF integration
|
|||
test. Coverage includes:
|
||||
|
||||
- diagnostic contracts, evidence integrity, fixtures, and the rule catalog;
|
||||
- immutable draft generation, regeneration, branding, races, and no-replace publication;
|
||||
- draft generation, regeneration, branding, and unique destination handling;
|
||||
- Reportist contract validation, rendering, assets, pagination, and standalone use;
|
||||
- capture analysis, report adaptation, validation, and PDF rendering as one workflow.
|
||||
|
||||
|
|
|
|||
2
reporter
2
reporter
|
|
@ -1 +1 @@
|
|||
Subproject commit eff5e623b75a74430025a3218a132708046063f2
|
||||
Subproject commit 7a7ba72524a30ece719f7ec4ab0209701d40ff92
|
||||
2
reports
2
reports
|
|
@ -1 +1 @@
|
|||
Subproject commit db6d811449de8ea188cd60f7ab38cef84ce93ab1
|
||||
Subproject commit 11cd0f615bddb13bc5eb34287fc431509d981f5f
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
cd "$(dirname "${BASH_SOURCE[0]}")/.."
|
||||
output_root=${1:-}
|
||||
[[ -n "$output_root" && $# -eq 1 ]]||{ echo "Usage: $0 NEW_OUTPUT_ROOT" >&2; exit 2; }
|
||||
[[ ! -e "$output_root" ]]||{ echo "$output_root: output root already exists" >&2; exit 1; }
|
||||
mkdir -p "$output_root/reports" "$output_root/diagnostics"
|
||||
reports/tools/convert-legacy-reports.sh reports/archive/typst_reporter/reports "$output_root/reports/sources"
|
||||
reporter/tools/validate-all.sh "$output_root/reports/sources"
|
||||
reporter/tools/render-all.sh "$output_root/reports/sources" --output-dir "$output_root/reports/pdfs"
|
||||
scripts/workflow-all.sh reports/archive/typst_reporter/diagnostics \
|
||||
reports/archive/typst_reporter/diagnostics "$output_root/diagnostic-work" \
|
||||
2026-09-15T12:15:00Z 'Diagnostic report' "${DIAGNOSTICS_AUTHOR:-Beffroi}" 2026-09-15
|
||||
cp -R "$output_root/diagnostic-work/pdfs/." "$output_root/diagnostics/"
|
||||
echo "Built publishable reports under $output_root"
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
set +x
|
||||
: "${REPORT_ZIP_PASSWORD:?Set REPORT_ZIP_PASSWORD to encrypt publication archives}"
|
||||
build_root=${1:-}; artifact_dir=${2:-}
|
||||
[[ -n "$build_root" && -n "$artifact_dir" && $# -eq 2 ]]||{ echo "Usage: $0 BUILD_ROOT ARTIFACT_DIR" >&2; exit 2; }
|
||||
build_root=$(realpath "$build_root"); mkdir -p "$artifact_dir"; artifact_dir=$(realpath "$artifact_dir")
|
||||
for command in zip unzip openssl; do command -v "$command" >/dev/null||{ echo "$command is required" >&2; exit 1; }; done
|
||||
stage=$(mktemp -d "${TMPDIR:-/tmp}/report-package.XXXXXXXX"); trap 'rm -rf "$stage"' EXIT
|
||||
for category in Reports Diagnostics; do
|
||||
source_dir="$build_root/${category,,}/pdfs"; [[ -d "$source_dir" ]]||source_dir="$build_root/${category,,}"
|
||||
count=0
|
||||
while IFS= read -r -d '' pdf; do [[ -s "$pdf" && $(head -c 5 "$pdf") == '%PDF-' ]]||{ echo "Invalid PDF: $pdf" >&2; exit 1; }; ((count+=1)); done < <(find "$source_dir" -type f -name '*.pdf' -print0)
|
||||
((count > 0))||{ echo "No PDFs for $category" >&2; exit 1; }
|
||||
(cd "$source_dir" && zip -q -r "$stage/$category.zip" . -i '*.pdf')
|
||||
openssl enc -aes-256-cbc -salt -pbkdf2 -pass env:REPORT_ZIP_PASSWORD -in "$stage/$category.zip" -out "$artifact_dir/$category.zip.enc"
|
||||
openssl enc -d -aes-256-cbc -pbkdf2 -pass env:REPORT_ZIP_PASSWORD -in "$artifact_dir/$category.zip.enc" -out "$stage/$category.verify.zip"
|
||||
unzip -tq "$stage/$category.verify.zip" >/dev/null
|
||||
done
|
||||
echo "Created encrypted report archives in $artifact_dir"
|
||||
|
|
@ -21,8 +21,7 @@ require_values() {
|
|||
done
|
||||
}
|
||||
|
||||
for executable in typst cargo; do command -v "$executable" >/dev/null || { echo "Missing runtime dependency: $executable" >&2; exit 1; }; done
|
||||
[[ -x reports/.tools/bin/publish-exclusive ]] || reports/install.sh
|
||||
command -v typst >/dev/null || { echo "Missing runtime dependency: typst" >&2; exit 1; }
|
||||
|
||||
analyse() {
|
||||
[[ $# -eq 4 ]] || usage
|
||||
|
|
|
|||
Loading…
Reference in New Issue