Use Jenkins secret for report archive encryption
Report CI typst_reporter passed all CI checks.
Beffroi/typst_reporter/pipeline/head This commit looks good Details

This commit is contained in:
Dandaedre 2026-09-14 19:17:20 +02:00
parent 6459ed9058
commit 25ed54ea0f
Signed by: Dandaedre
GPG Key ID: 440C6592E8A26D99
2 changed files with 15 additions and 7 deletions

5
Jenkinsfile vendored
View File

@ -13,8 +13,6 @@ pipeline {
CI_ARTIFACT_DIR = '.ci-artifacts'
DEPLOY_DIR = '/mnt/books/Reports'
DIAGNOSTICS_AUTHOR = 'Beffroi'
// Later replace with credentials('reports-zip-password') (Secret text).
REPORT_ZIP_PASSWORD = 'CHANGE_ME'
}
stages {
@ -103,6 +101,9 @@ pipeline {
}
stage('Package Reports') {
environment {
REPORT_ZIP_PASSWORD = credentials('typst-reporter-publish-password')
}
steps {
sh '''
set +x

View File

@ -132,15 +132,22 @@ and write access to `/mnt/books/Reports`. `DIAGNOSTICS_AUTHOR` defaults to Beffr
Jenkins installs pinned [pyzipper](https://pypi.org/project/pyzipper/) into `.ci-venv`
and creates AES-256 ZIPs without a system `zip` executable. Extract with an
AES-capable ZIP reader, such as 7-Zip.
The temporary password is `CHANGE_ME`; it is a public placeholder, not a secret.
Later create a Jenkins **Secret text** credential and replace the Jenkinsfile
assignment with `REPORT_ZIP_PASSWORD = credentials('reports-zip-password')`.
The packaging script reads that environment variable with shell tracing disabled.
Jenkins binds the **Secret text** credential `typst-reporter-publish-password`
to `REPORT_ZIP_PASSWORD` only during the packaging stage. The credential must be
accessible to this job. The packaging script requires a nonempty password and
reads it from the environment with shell tracing disabled; there is no fallback
password. The next successful publication replaces both ZIPs using this secret.
To package an existing local build:
```bash
uv venv --allow-existing .ci-venv
uv pip install --python .ci-venv/bin/python -r tools/packaging-requirements.txt
PACKAGING_PYTHON=.ci-venv/bin/python REPORT_ZIP_PASSWORD=CHANGE_ME ./tools/package-reports.sh
# Prompt without echoing the password or storing it in shell history.
set +x
read -r -s -p 'Archive password: ' REPORT_ZIP_PASSWORD
printf '\n'
export REPORT_ZIP_PASSWORD
PACKAGING_PYTHON=.ci-venv/bin/python ./tools/package-reports.sh
unset REPORT_ZIP_PASSWORD
```