From 5d5125d618c0c6cac8a67eb5363496232a6a2ae5 Mon Sep 17 00:00:00 2001 From: James Maes Date: Wed, 18 Mar 2026 12:39:28 -0500 Subject: [PATCH] feat: make org defaults overridable via .munitor.yml org section --- src/@orb.yml | 9 +++++---- src/scripts/extract_munitor_vars.sh | 12 ++++++------ src/scripts/packed_generate_config.sh | 12 ++++++------ src/scripts/packed_generate_dockerfile.sh | 12 ++++++------ src/scripts/update_cd_repo.sh | 4 ++-- 5 files changed, 25 insertions(+), 24 deletions(-) diff --git a/src/@orb.yml b/src/@orb.yml index 0004044..17f533f 100644 --- a/src/@orb.yml +++ b/src/@orb.yml @@ -1,10 +1,11 @@ version: 2.1 description: > - Munitor (Latin: fortifier, protector) -- KofTwentyTwo's unified CircleCI orb - for building, testing, and deploying all repositories. Provides standardized - CI/CD pipelines via dynamic configuration so each repo needs only a tiny - .munitor.yml to define its pipeline. + Munitor (Latin: fortifier, protector) -- a unified CircleCI orb for building, + testing, and deploying repositories. Provides standardized CI/CD pipelines via + dynamic configuration so each repo needs only a tiny .munitor.yml to define + its pipeline. Org-agnostic: override defaults via the optional org section in + .munitor.yml. display: home_url: https://github.com/KofTwentyTwo/Munitor diff --git a/src/scripts/extract_munitor_vars.sh b/src/scripts/extract_munitor_vars.sh index 1fc545f..673e22c 100644 --- a/src/scripts/extract_munitor_vars.sh +++ b/src/scripts/extract_munitor_vars.sh @@ -12,12 +12,12 @@ extract_munitor_vars() { return 1 fi - # --- Org defaults (change this block when forking for another org) --- - local ORG_DOCKER_REGISTRY="ghcr.io/KofTwentyTwo" - local ORG_NPM_SCOPE="@koftwentytwo" - local ORG_CI_EMAIL="munitor-ci@koftwentytwo.com" - local ORG_CI_NAME="Munitor CI" - local ORG_ORB_SLUG="kof22/munitor" + # --- Org defaults (overridable via .munitor.yml org section) --- + local ORG_DOCKER_REGISTRY=$(yq '.org.docker_registry // "ghcr.io/KofTwentyTwo"' "${config_file}") + local ORG_NPM_SCOPE=$(yq '.org.npm_scope // "@koftwentytwo"' "${config_file}") + local ORG_CI_EMAIL=$(yq '.org.ci_email // "munitor-ci@koftwentytwo.com"' "${config_file}") + local ORG_CI_NAME=$(yq '.org.ci_name // "Munitor CI"' "${config_file}") + local ORG_ORB_SLUG=$(yq '.org.orb_slug // "kof22/munitor"' "${config_file}") # Core pipeline settings MUNITOR_PIPELINE=$(yq '.pipeline' "${config_file}") diff --git a/src/scripts/packed_generate_config.sh b/src/scripts/packed_generate_config.sh index d8dd563..902d2b1 100755 --- a/src/scripts/packed_generate_config.sh +++ b/src/scripts/packed_generate_config.sh @@ -109,12 +109,12 @@ extract_munitor_vars() { return 1 fi - # --- Org defaults (change this block when forking for another org) --- - local ORG_DOCKER_REGISTRY="ghcr.io/KofTwentyTwo" - local ORG_NPM_SCOPE="@koftwentytwo" - local ORG_CI_EMAIL="munitor-ci@koftwentytwo.com" - local ORG_CI_NAME="Munitor CI" - local ORG_ORB_SLUG="kof22/munitor" + # --- Org defaults (overridable via .munitor.yml org section) --- + local ORG_DOCKER_REGISTRY=$(yq '.org.docker_registry // "ghcr.io/KofTwentyTwo"' "${config_file}") + local ORG_NPM_SCOPE=$(yq '.org.npm_scope // "@koftwentytwo"' "${config_file}") + local ORG_CI_EMAIL=$(yq '.org.ci_email // "munitor-ci@koftwentytwo.com"' "${config_file}") + local ORG_CI_NAME=$(yq '.org.ci_name // "Munitor CI"' "${config_file}") + local ORG_ORB_SLUG=$(yq '.org.orb_slug // "kof22/munitor"' "${config_file}") # Core pipeline settings MUNITOR_PIPELINE=$(yq '.pipeline' "${config_file}") diff --git a/src/scripts/packed_generate_dockerfile.sh b/src/scripts/packed_generate_dockerfile.sh index 2c49286..d468367 100755 --- a/src/scripts/packed_generate_dockerfile.sh +++ b/src/scripts/packed_generate_dockerfile.sh @@ -109,12 +109,12 @@ extract_munitor_vars() { return 1 fi - # --- Org defaults (change this block when forking for another org) --- - local ORG_DOCKER_REGISTRY="ghcr.io/KofTwentyTwo" - local ORG_NPM_SCOPE="@koftwentytwo" - local ORG_CI_EMAIL="munitor-ci@koftwentytwo.com" - local ORG_CI_NAME="Munitor CI" - local ORG_ORB_SLUG="kof22/munitor" + # --- Org defaults (overridable via .munitor.yml org section) --- + local ORG_DOCKER_REGISTRY=$(yq '.org.docker_registry // "ghcr.io/KofTwentyTwo"' "${config_file}") + local ORG_NPM_SCOPE=$(yq '.org.npm_scope // "@koftwentytwo"' "${config_file}") + local ORG_CI_EMAIL=$(yq '.org.ci_email // "munitor-ci@koftwentytwo.com"' "${config_file}") + local ORG_CI_NAME=$(yq '.org.ci_name // "Munitor CI"' "${config_file}") + local ORG_ORB_SLUG=$(yq '.org.orb_slug // "kof22/munitor"' "${config_file}") # Core pipeline settings MUNITOR_PIPELINE=$(yq '.pipeline' "${config_file}") diff --git a/src/scripts/update_cd_repo.sh b/src/scripts/update_cd_repo.sh index 0ca5f44..6074a00 100755 --- a/src/scripts/update_cd_repo.sh +++ b/src/scripts/update_cd_repo.sh @@ -129,8 +129,8 @@ if [[ "${SUPP_JSON}" != "[]" && "${SUPP_JSON}" != "null" ]]; then fi # Commit and push -git config user.email "${CI_GIT_EMAIL:-munitor-ci@koftwentytwo.com}" -git config user.name "${CI_GIT_NAME:-Munitor CI}" +git config user.email "${CI_GIT_EMAIL:-${MUNITOR_CI_EMAIL:-munitor-ci@koftwentytwo.com}}" +git config user.name "${CI_GIT_NAME:-${MUNITOR_CI_NAME:-Munitor CI}}" if git diff --cached --quiet; then echo "No changes to commit (version already up to date)." -- 2.54.0