Update Jenkinsfile
Database Integrity At least one Ravenous database failed validation.
Ravenous/ravenous_typst/pipeline/head There was a failure building this commit
Details
Database Integrity At least one Ravenous database failed validation.
Ravenous/ravenous_typst/pipeline/head There was a failure building this commit
Details
This commit is contained in:
parent
e551153254
commit
e8dc000c26
|
|
@ -4,58 +4,8 @@
|
|||
pipeline {
|
||||
agent { label 'rust_no_docker' }
|
||||
|
||||
parameters {
|
||||
choice(
|
||||
name: 'PLAYER_THEME',
|
||||
choices: ['warm', 'steel', 'fangdrael', 'bw', 'high-contrast', 'yon-sen', 'steingrund', 'treorst', 'anankar', 'drekinsteps', 'draan'],
|
||||
description: 'Color theme for the player handbook.'
|
||||
)
|
||||
string(
|
||||
name: 'PLAYER_CHAPTERS',
|
||||
defaultValue: '',
|
||||
description: 'Optional comma-separated player-handbook chapter allow-list.'
|
||||
)
|
||||
string(
|
||||
name: 'PLAYER_DISABLED_CHAPTERS',
|
||||
defaultValue: '',
|
||||
description: 'Optional comma-separated player-handbook chapter deny-list.'
|
||||
)
|
||||
}
|
||||
|
||||
environment {
|
||||
SOURCE_FILE = "main.typ"
|
||||
OUTPUT_FILE = "Ravenous_build.pdf"
|
||||
PUBLISHED_FILE = "Ravenous.pdf"
|
||||
PRINTABLE_OUTPUT_FILE = "Ravenous_printable_build.pdf"
|
||||
PRINTABLE_PUBLISHED_FILE = "Ravenous_printable.pdf"
|
||||
CHANGELOG_SOURCE_FILE = "changelog.typ"
|
||||
CHANGELOG_OUTPUT_FILE = "Ravenous_changelog_build.pdf"
|
||||
CHANGELOG_PUBLISHED_FILE = "Ravenous_changelog.pdf"
|
||||
BALANCE_SOURCE_FILE = "balance_report.typ"
|
||||
BALANCE_OUTPUT_FILE = "Report/Ravenous_balance_report_build.pdf"
|
||||
BALANCE_PUBLISHED_FILE = "Ravenous_balance_report.pdf"
|
||||
MASTER_SOURCE_FILE = "master_handbook.typ"
|
||||
MASTER_PLAINTEXT_FILE = "Master/Ravenous_master_handbook_plaintext.pdf"
|
||||
MASTER_OUTPUT_FILE = "Master/Ravenous_master_handbook_build.pdf"
|
||||
MASTER_PUBLISHED_FILE = "Ravenous_master_handbook.pdf"
|
||||
MASTER_BALANCE_SOURCE_FILE = "balance_report_master.typ"
|
||||
MASTER_BALANCE_PLAINTEXT_FILE = "Report/Ravenous_master_balance_report_plaintext.pdf"
|
||||
MASTER_BALANCE_OUTPUT_FILE = "Report/Ravenous_master_balance_report_build.pdf"
|
||||
MASTER_BALANCE_PUBLISHED_FILE = "Ravenous_master_balance_report.pdf"
|
||||
PLAYER_SOURCE_FILE = "player_handbook.typ"
|
||||
PLAYER_OUTPUT_FILE = "Player/Ravenous_player_handbook_build.pdf"
|
||||
PLAYER_PUBLISHED_FILE = "Ravenous_player_handbook.pdf"
|
||||
COOKBOOK_SOURCE_FILE = "cookbook.typ"
|
||||
COOKBOOK_OUTPUT_FILE = "Player/Ravenous_cookbook_build.pdf"
|
||||
COOKBOOK_PUBLISHED_FILE = "Ravenous_cookbook.pdf"
|
||||
SCREEN_SOURCE_FILE = "master_screen.typ"
|
||||
SCREEN_PLAINTEXT_FILE = "Master/Ravenous_master_screen_plaintext.pdf"
|
||||
SCREEN_OUTPUT_FILE = "Master/Ravenous_master_screen_build.pdf"
|
||||
SCREEN_PUBLISHED_FILE = "Ravenous_master_screen.pdf"
|
||||
MASTER_PASSWORD = "billy"
|
||||
|
||||
// Important: published books live under /mnt/books
|
||||
DEPLOY_DIR = "/mnt/books/Ravenous"
|
||||
VENV = '.venv'
|
||||
}
|
||||
|
||||
stages {
|
||||
|
|
@ -64,289 +14,105 @@ pipeline {
|
|||
checkout scm
|
||||
|
||||
sh '''
|
||||
set -e
|
||||
|
||||
git submodule sync --recursive
|
||||
git submodule update --init --recursive
|
||||
'''
|
||||
}
|
||||
}
|
||||
|
||||
stage('Install Typst') {
|
||||
stage('Setup Python') {
|
||||
steps {
|
||||
sh '''
|
||||
set -e
|
||||
set -eu
|
||||
|
||||
if ! command -v cargo-binstall >/dev/null 2>&1; then
|
||||
echo "cargo-binstall not found — installing it..."
|
||||
cargo install cargo-binstall
|
||||
else
|
||||
echo "cargo-binstall already installed."
|
||||
fi
|
||||
if ! command -v uv >/dev/null 2>&1; then
|
||||
echo "uv not found — installing it..."
|
||||
|
||||
if ! command -v typst >/dev/null 2>&1; then
|
||||
echo "Typst not found — installing it..."
|
||||
cargo binstall --no-confirm typst-cli
|
||||
if ! command -v cargo-binstall >/dev/null 2>&1; then
|
||||
echo "cargo-binstall not found — installing it..."
|
||||
cargo install cargo-binstall
|
||||
fi
|
||||
|
||||
cargo binstall --no-confirm uv
|
||||
else
|
||||
echo "Typst already installed."
|
||||
echo "uv already installed."
|
||||
fi
|
||||
|
||||
echo "Using:"
|
||||
typst --version
|
||||
uv --version
|
||||
|
||||
if ! command -v qpdf >/dev/null 2>&1; then
|
||||
echo "qpdf is required to protect the master handbook." >&2
|
||||
exit 1
|
||||
fi
|
||||
rm -rf "${VENV}"
|
||||
|
||||
qpdf --version
|
||||
echo "Creating virtual environment..."
|
||||
uv venv "${VENV}"
|
||||
|
||||
echo "Installing CI dependencies..."
|
||||
uv pip install \
|
||||
--python "${VENV}/bin/python" \
|
||||
-r tools/requirements-ci.txt
|
||||
|
||||
echo
|
||||
echo "Python:"
|
||||
"${VENV}/bin/python" --version
|
||||
'''
|
||||
}
|
||||
}
|
||||
|
||||
stage('Build PDFs') {
|
||||
stage('Check Database Integrity') {
|
||||
steps {
|
||||
sh '''
|
||||
set -e
|
||||
set -eu
|
||||
|
||||
echo "Generating build metadata"
|
||||
./tools/pseudo_toolchain.sh
|
||||
|
||||
mkdir -p Report Player Master
|
||||
|
||||
echo "Building ${SOURCE_FILE} -> ${OUTPUT_FILE}"
|
||||
typst compile "${SOURCE_FILE}" "${OUTPUT_FILE}"
|
||||
|
||||
echo "Building printable ${SOURCE_FILE} -> ${PRINTABLE_OUTPUT_FILE}"
|
||||
typst compile \
|
||||
--input printable=true \
|
||||
"${SOURCE_FILE}" "${PRINTABLE_OUTPUT_FILE}"
|
||||
|
||||
echo "Building ${CHANGELOG_SOURCE_FILE} -> ${CHANGELOG_OUTPUT_FILE}"
|
||||
typst compile \
|
||||
--input changelog-hidden-categories=formatting,reporting \
|
||||
"${CHANGELOG_SOURCE_FILE}" "${CHANGELOG_OUTPUT_FILE}"
|
||||
|
||||
echo "Building ${BALANCE_SOURCE_FILE} -> ${BALANCE_OUTPUT_FILE}"
|
||||
typst compile "${BALANCE_SOURCE_FILE}" "${BALANCE_OUTPUT_FILE}"
|
||||
|
||||
echo "Building ${PLAYER_SOURCE_FILE} -> ${PLAYER_OUTPUT_FILE}"
|
||||
typst compile \
|
||||
--input preset=player-handbook \
|
||||
--input theme="${PLAYER_THEME}" \
|
||||
--input chapters="${PLAYER_CHAPTERS}" \
|
||||
--input disabled_chapters="${PLAYER_DISABLED_CHAPTERS}" \
|
||||
"${PLAYER_SOURCE_FILE}" "${PLAYER_OUTPUT_FILE}"
|
||||
|
||||
echo "Building ${COOKBOOK_SOURCE_FILE} -> ${COOKBOOK_OUTPUT_FILE}"
|
||||
typst compile \
|
||||
--input preset=player-handbook \
|
||||
--input theme="${PLAYER_THEME}" \
|
||||
"${COOKBOOK_SOURCE_FILE}" "${COOKBOOK_OUTPUT_FILE}"
|
||||
|
||||
echo "Building ${MASTER_SOURCE_FILE} -> ${MASTER_PLAINTEXT_FILE}"
|
||||
typst compile "${MASTER_SOURCE_FILE}" "${MASTER_PLAINTEXT_FILE}"
|
||||
|
||||
echo "Protecting the master handbook (password: ${MASTER_PASSWORD})"
|
||||
qpdf --allow-weak-crypto \
|
||||
--encrypt "${MASTER_PASSWORD}" "${MASTER_PASSWORD}" 40 -- \
|
||||
"${MASTER_PLAINTEXT_FILE}" "${MASTER_OUTPUT_FILE}"
|
||||
|
||||
echo "Building ${MASTER_BALANCE_SOURCE_FILE} -> ${MASTER_BALANCE_PLAINTEXT_FILE}"
|
||||
typst compile "${MASTER_BALANCE_SOURCE_FILE}" "${MASTER_BALANCE_PLAINTEXT_FILE}"
|
||||
|
||||
echo "Protecting the master balance report with the master-handbook policy"
|
||||
qpdf --allow-weak-crypto \
|
||||
--encrypt "${MASTER_PASSWORD}" "${MASTER_PASSWORD}" 40 -- \
|
||||
"${MASTER_BALANCE_PLAINTEXT_FILE}" "${MASTER_BALANCE_OUTPUT_FILE}"
|
||||
|
||||
echo "Building ${SCREEN_SOURCE_FILE} -> ${SCREEN_PLAINTEXT_FILE}"
|
||||
typst compile "${SCREEN_SOURCE_FILE}" "${SCREEN_PLAINTEXT_FILE}"
|
||||
|
||||
echo "Protecting the master screen with the master-handbook policy"
|
||||
qpdf --allow-weak-crypto \
|
||||
--encrypt "${MASTER_PASSWORD}" "${MASTER_PASSWORD}" 40 -- \
|
||||
"${SCREEN_PLAINTEXT_FILE}" "${SCREEN_OUTPUT_FILE}"
|
||||
|
||||
test -f "${OUTPUT_FILE}"
|
||||
test -f "${PRINTABLE_OUTPUT_FILE}"
|
||||
test -f "${CHANGELOG_OUTPUT_FILE}"
|
||||
test -f "${BALANCE_OUTPUT_FILE}"
|
||||
test -f "${PLAYER_OUTPUT_FILE}"
|
||||
test -f "${COOKBOOK_OUTPUT_FILE}"
|
||||
test -f "${MASTER_OUTPUT_FILE}"
|
||||
test -f "${MASTER_BALANCE_OUTPUT_FILE}"
|
||||
test -f "${SCREEN_OUTPUT_FILE}"
|
||||
|
||||
# Never archive or publish unprotected master intermediates.
|
||||
rm "${MASTER_PLAINTEXT_FILE}" "${MASTER_BALANCE_PLAINTEXT_FILE}" "${SCREEN_PLAINTEXT_FILE}"
|
||||
|
||||
echo "Builds complete:"
|
||||
ls -lh \
|
||||
"${OUTPUT_FILE}" \
|
||||
"${PRINTABLE_OUTPUT_FILE}" \
|
||||
"${CHANGELOG_OUTPUT_FILE}" \
|
||||
"${BALANCE_OUTPUT_FILE}" \
|
||||
"${PLAYER_OUTPUT_FILE}" \
|
||||
"${COOKBOOK_OUTPUT_FILE}" \
|
||||
"${MASTER_OUTPUT_FILE}" \
|
||||
"${MASTER_BALANCE_OUTPUT_FILE}" \
|
||||
"${SCREEN_OUTPUT_FILE}"
|
||||
"${VENV}/bin/python" \
|
||||
tools/check_databases.py
|
||||
'''
|
||||
}
|
||||
}
|
||||
|
||||
stage('Archive PDFs') {
|
||||
steps {
|
||||
archiveArtifacts(
|
||||
artifacts: "${OUTPUT_FILE},${PRINTABLE_OUTPUT_FILE},${CHANGELOG_OUTPUT_FILE},${PLAYER_OUTPUT_FILE},${COOKBOOK_OUTPUT_FILE},${BALANCE_OUTPUT_FILE},${MASTER_OUTPUT_FILE},${MASTER_BALANCE_OUTPUT_FILE},${SCREEN_OUTPUT_FILE}",
|
||||
fingerprint: true
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
stage('Deploy PDFs') {
|
||||
steps {
|
||||
script {
|
||||
def reviewBranches = [
|
||||
'origin/lighthouse',
|
||||
'lighthouse'
|
||||
]
|
||||
|
||||
def devBranches = [
|
||||
'origin/candlelight',
|
||||
'candlelight'
|
||||
]
|
||||
|
||||
def masterBranches = [
|
||||
'origin/lighthouse',
|
||||
'lighthouse'
|
||||
]
|
||||
|
||||
def targetDir
|
||||
|
||||
if (reviewBranches.contains(env.BRANCH_NAME)) {
|
||||
targetDir = "${DEPLOY_DIR}_lighthouse"
|
||||
} else if (devBranches.contains(env.BRANCH_NAME)) {
|
||||
targetDir = "${DEPLOY_DIR}_candlelight"
|
||||
} else if (masterBranches.contains(env.BRANCH_NAME)) {
|
||||
targetDir = DEPLOY_DIR
|
||||
} else {
|
||||
echo "Branch '${env.BRANCH_NAME}' is not a publication branch — skipping deployment."
|
||||
return
|
||||
}
|
||||
|
||||
deployTo(targetDir)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
post {
|
||||
success {
|
||||
publishChecks(
|
||||
conclusion: 'SUCCESS',
|
||||
name: 'Build Successful',
|
||||
summary: 'The Ravenous rulebook, changelog, player books, master handbook, and balance reports were built successfully.',
|
||||
text: 'All nine PDFs, including the printable rulebook, were compiled and published successfully.',
|
||||
title: 'Build Successful'
|
||||
name: 'Database Integrity',
|
||||
summary: 'All Ravenous databases passed integrity checks.',
|
||||
text: 'SQLite integrity and foreign-key validation completed successfully.',
|
||||
title: 'Database integrity successful'
|
||||
)
|
||||
|
||||
echo '✅ Ravenous books and balance reports built and published!'
|
||||
echo '✅ All Ravenous databases passed integrity checks.'
|
||||
}
|
||||
|
||||
failure {
|
||||
publishChecks(
|
||||
conclusion: 'FAILURE',
|
||||
name: 'Build Failed',
|
||||
summary: 'A Ravenous PDF build or deployment failed.',
|
||||
text: 'Rulebook, master-handbook, or balance-report compilation/publication failed.',
|
||||
title: 'Build Failed'
|
||||
name: 'Database Integrity',
|
||||
summary: 'At least one Ravenous database failed validation.',
|
||||
text: 'Check the Jenkins log for database integrity or environment errors.',
|
||||
title: 'Database integrity failed'
|
||||
)
|
||||
|
||||
echo '❌ A Ravenous PDF failed to build or publish.'
|
||||
echo '❌ Ravenous database integrity CI failed.'
|
||||
}
|
||||
|
||||
unstable {
|
||||
publishChecks(
|
||||
conclusion: 'ACTION_REQUIRED',
|
||||
name: 'Build Unstable',
|
||||
summary: 'The Ravenous rulebook build is unstable.',
|
||||
text: 'The Jenkins build completed with an unstable status.',
|
||||
title: 'Build Unstable'
|
||||
name: 'Database Integrity',
|
||||
summary: 'The Ravenous database integrity job is unstable.',
|
||||
text: 'Check the Jenkins build log.',
|
||||
title: 'Database integrity unstable'
|
||||
)
|
||||
|
||||
echo '⚠️ Ravenous build is unstable.'
|
||||
echo '⚠️ Ravenous database integrity CI is unstable.'
|
||||
}
|
||||
|
||||
always {
|
||||
sh '''
|
||||
rm -rf .venv
|
||||
'''
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Publish the generated Ravenous PDFs.
|
||||
*
|
||||
* Build artifacts retain explicit CI names in Jenkins, while published copies
|
||||
* use stable rulebook, changelog, master-handbook, and balance-report names.
|
||||
* Master-facing PDFs are encrypted before either step.
|
||||
*
|
||||
* @param targetDir Directory receiving the compiled book.
|
||||
*/
|
||||
def deployTo(String targetDir) {
|
||||
sh """
|
||||
set -e
|
||||
|
||||
echo "Publishing Ravenous, its player and master handbooks, and its balance reports to ${targetDir}"
|
||||
|
||||
mkdir -p \
|
||||
"${targetDir}" \
|
||||
"${targetDir}/Report" \
|
||||
"${targetDir}/Player" \
|
||||
"${targetDir}/Master"
|
||||
|
||||
rsync -a \
|
||||
"${env.OUTPUT_FILE}" \
|
||||
"${targetDir}/${env.PUBLISHED_FILE}"
|
||||
|
||||
rsync -a \
|
||||
"${env.PRINTABLE_OUTPUT_FILE}" \
|
||||
"${targetDir}/${env.PRINTABLE_PUBLISHED_FILE}"
|
||||
|
||||
rsync -a \
|
||||
"${env.CHANGELOG_OUTPUT_FILE}" \
|
||||
"${targetDir}/${env.CHANGELOG_PUBLISHED_FILE}"
|
||||
|
||||
rsync -a \
|
||||
"${env.BALANCE_OUTPUT_FILE}" \
|
||||
"${targetDir}/Report/${env.BALANCE_PUBLISHED_FILE}"
|
||||
|
||||
rsync -a \
|
||||
"${env.PLAYER_OUTPUT_FILE}" \
|
||||
"${targetDir}/Player/${env.PLAYER_PUBLISHED_FILE}"
|
||||
|
||||
rsync -a \
|
||||
"${env.COOKBOOK_OUTPUT_FILE}" \
|
||||
"${targetDir}/Player/${env.COOKBOOK_PUBLISHED_FILE}"
|
||||
|
||||
rsync -a \
|
||||
"${env.MASTER_OUTPUT_FILE}" \
|
||||
"${targetDir}/Master/${env.MASTER_PUBLISHED_FILE}"
|
||||
|
||||
rsync -a \
|
||||
"${env.MASTER_BALANCE_OUTPUT_FILE}" \
|
||||
"${targetDir}/Report/${env.MASTER_BALANCE_PUBLISHED_FILE}"
|
||||
|
||||
rsync -a \
|
||||
"${env.SCREEN_OUTPUT_FILE}" \
|
||||
"${targetDir}/Master/${env.SCREEN_PUBLISHED_FILE}"
|
||||
|
||||
echo "Published:"
|
||||
ls -lh \
|
||||
"${targetDir}/${env.PUBLISHED_FILE}" \
|
||||
"${targetDir}/${env.PRINTABLE_PUBLISHED_FILE}" \
|
||||
"${targetDir}/${env.CHANGELOG_PUBLISHED_FILE}" \
|
||||
"${targetDir}/Report/${env.BALANCE_PUBLISHED_FILE}" \
|
||||
"${targetDir}/Player/${env.PLAYER_PUBLISHED_FILE}" \
|
||||
"${targetDir}/Player/${env.COOKBOOK_PUBLISHED_FILE}" \
|
||||
"${targetDir}/Master/${env.MASTER_PUBLISHED_FILE}" \
|
||||
"${targetDir}/Report/${env.MASTER_BALANCE_PUBLISHED_FILE}" \
|
||||
"${targetDir}/Master/${env.SCREEN_PUBLISHED_FILE}"
|
||||
"""
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue