Files
Munitor/scripts/pack_generate_config.sh
james.maesandCodex a56ef1d8e7 feat: add docs-only Java CI and aggregate merge checks
Retain all applicable checks behind one result and use native CircleCI reporting.

Co-Authored-By: Codex <noreply@openai.com>
Signed-off-by: James Maes <james@kof22.com>
2026-10-19 14:10:56 -05:00

78 lines
2.6 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
# Build a self-contained generate_config.sh that embeds all helpers
# and templates. The orb includes this packed version via << include() >>.
#
# Source files remain separate in src/scripts/ for development and testing.
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_DIR="$(cd "${SCRIPT_DIR}/.." && pwd)"
SRC="${PROJECT_DIR}/src/scripts"
OUT="${SRC}/packed_generate_config.sh"
echo "Packing generate_config.sh..."
{
echo '#!/usr/bin/env bash'
echo 'set -euo pipefail'
echo ''
echo '# ======================================================================'
echo '# AUTO-GENERATED by scripts/pack_generate_config.sh'
echo '# Do not edit directly. Edit src/scripts/*.sh and re-pack.'
echo '# ======================================================================'
echo ''
echo '# Stage helper files to /tmp/munitor/ so generate_config.sh can find them'
echo 'mkdir -p /tmp/munitor/templates/partials'
echo ''
# Embed munitor_helpers.sh
echo 'cat > /tmp/munitor/munitor_helpers.sh << '"'"'MUNITOR_HELPERS_EOF'"'"
cat "${SRC}/munitor_helpers.sh"
echo 'MUNITOR_HELPERS_EOF'
echo ''
# Embed extract_munitor_vars.sh
echo 'cat > /tmp/munitor/extract_munitor_vars.sh << '"'"'MUNITOR_EXTRACT_EOF'"'"
cat "${SRC}/extract_munitor_vars.sh"
echo 'MUNITOR_EXTRACT_EOF'
echo ''
# Embed conservative documentation-only classification.
echo "cat > /tmp/munitor/docs_only.sh << 'MUNITOR_DOCS_EOF'"
cat "${SRC}/docs_only.sh"
echo 'MUNITOR_DOCS_EOF'
echo ''
# Embed each template
for tpl in java-docs java-webapp gradle-webapp node-api node-webapp terraform sdk-distribution validate-cd-repo argocd-apps obsidian-plugin; do
echo "cat > /tmp/munitor/templates/${tpl}.yml.tpl << 'MUNITOR_TPL_EOF'"
cat "${SRC}/templates/${tpl}.yml.tpl"
echo 'MUNITOR_TPL_EOF'
echo ''
done
# Embed partials
for partial in java-webapp-deploy gradle-webapp-deploy node-api-deploy node-webapp-deploy; do
echo "cat > /tmp/munitor/templates/partials/${partial}.yml.tpl << 'MUNITOR_PARTIAL_EOF'"
cat "${SRC}/templates/partials/${partial}.yml.tpl"
echo 'MUNITOR_PARTIAL_EOF'
echo ''
done
echo 'echo "Munitor helpers staged to /tmp/munitor/"'
echo ''
echo '# ======================================================================'
echo '# Main generate_config.sh logic'
echo '# ======================================================================'
echo ''
# Append the main script, skipping the shebang
tail -n +2 "${SRC}/generate_config.sh"
} > "${OUT}"
chmod +x "${OUT}"
echo "Packed to: ${OUT}"
echo "Lines: $(wc -l < "${OUT}")"