mirror of
https://github.com/shankar0123/certctl.git
synced 2026-06-07 15:51:30 +00:00
1caedd5fd3
Bundle: ci-pipeline-cleanup, Phase 1. Pure relocation — no behavior change. Each guard's bash logic is byte-identical to the prior inline version; the only changes are: (a) the guard becomes a sibling script under scripts/ci-guards/<id>.sh, (b) ci.yml's per-guard step is replaced by a single loop step that iterates all scripts. 20 scripts extracted (alphabetized): B-1-orphan-crud.sh, D-1-D-2-statusbadge-phantom.sh, G-1-jwt-auth-literal.sh, G-2-api-key-hash-json.sh, G-3-env-docs-drift.sh, H-001-bare-from.sh, H-009-readme-jwt.sh, L-001-insecure-skip-verify.sh, L-1-bulk-action-loop.sh, M-012-no-root-user.sh, P-1-documented-orphan-fns.sh, S-1-hardcoded-source-counts.sh, S-2-strings-contains-err.sh, T-1-frontend-page-coverage.sh, U-2-plaintext-healthcheck.sh, U-3-migration-mount.sh, bundle-8-L-015-target-blank-rel-noopener.sh, bundle-8-L-019-dangerously-set-inner-html.sh, bundle-8-M-009-bare-usemutation.sh, test-naming-convention.sh Plus scripts/ci-guards/README.md documenting the contract: - Each script must exit 0 on clean repo, non-zero with ::error:: prefix on regression - Runnable from repo root via 'bash scripts/ci-guards/<id>.sh' - Adding a new guard: drop a new <id>.sh; CI auto-picks it up ci.yml dropped 1488 → 557 lines (-931, -63%). Single CI loop step now collects ALL guard failures before failing the build instead of fail-fast — UX win for regressions that hit two guards at once. Two guards (QA-doc Part-count + seed-count, ci.yml lines 868-917) deliberately NOT extracted — they move to 'make verify-docs' in Phase 11 because they protect docs-the-operator-reads, not the product itself. Verification (sandbox): - All 20 scripts pass against HEAD (chmod +x; for g in scripts/ci-guards/*.sh; do bash $g; done) - New ci.yml YAML-parses cleanly - Job boundaries preserved: go-build-and-test, frontend-build, helm-lint, deploy-vendor-e2e, deploy-vendor-e2e-windows - Loop step appears twice (once at end of go-build-and-test, once at end of frontend-build) so both jobs continue running their set of guards
96 lines
4.1 KiB
Bash
Executable File
96 lines
4.1 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# scripts/ci-guards/G-3-env-docs-drift.sh
|
|
#
|
|
# G-3 master closed cat-g-163dae19bc59 (docs-only env vars
|
|
# phantom in features.md), cat-g-b8f8f8796159 (6 config-only
|
|
# env vars never documented), and cat-g-renewal_check_interval_rename_drift
|
|
# (features.md still advertised the pre-rename
|
|
# CERTCTL_RENEWAL_CHECK_INTERVAL after it was renamed to
|
|
# CERTCTL_SCHEDULER_RENEWAL_CHECK_INTERVAL). This script runs
|
|
# `comm -23` both ways between the env vars defined in Go
|
|
# source (config.go + cmd/agent + deploy/test fixtures + ACME
|
|
# DNS-01 script env exports) and the env vars mentioned in
|
|
# README + docs/ + deploy/helm/.
|
|
#
|
|
# Allowlist: env vars that are documented as integration-
|
|
# surface contracts (script env exports for ACME DNS-01,
|
|
# OpenSSL CA scripts, StepCA per-issuer-config-blob fields,
|
|
# Webhook per-notifier-config-blob fields, ACME EAB, audit
|
|
# exclusion, demo-stack overrides) but not consumed directly
|
|
# by config.go. Each entry below has a one-line justification
|
|
# — if you add a new entry, add the justification too.
|
|
#
|
|
# See coverage-gap-audit-2026-04-24-v5/unified-audit.md
|
|
# cat-g-* for closure rationale.
|
|
|
|
set -e
|
|
# Defined: config.go + agent + cli + mcp-server + server cmds + test fixtures + ACME DNS export
|
|
{
|
|
grep -nE '"CERTCTL_[A-Z_]+"' internal/config/config.go | sed -E 's/.*"(CERTCTL_[A-Z_]+)".*/\1/'
|
|
grep -rhoE '"CERTCTL_[A-Z_]+"' cmd/agent/*.go cmd/cli/*.go cmd/mcp-server/*.go cmd/server/*.go 2>/dev/null | sed -E 's/"(CERTCTL_[A-Z_]+)"/\1/'
|
|
grep -rhoE 'CERTCTL_[A-Z_]+' deploy/test/qa_test.go internal/connector/issuer/acme/dns.go 2>/dev/null
|
|
} | grep -E '^CERTCTL_' | sort -u > /tmp/g3-defined.txt
|
|
# Documented: README + docs + helm
|
|
grep -rhoE '\bCERTCTL_[A-Z_]+\b' README.md docs/ deploy/helm/ 2>/dev/null | sort -u > /tmp/g3-docs.txt
|
|
# Allowlist of env vars documented as external integration contracts.
|
|
# Each entry justifies itself in one line; if you add to this list,
|
|
# add the justification.
|
|
ALLOWED='^(
|
|
CERTCTL_OPENSSL_SIGN_SCRIPT|
|
|
CERTCTL_OPENSSL_REVOKE_SCRIPT|
|
|
CERTCTL_OPENSSL_CRL_SCRIPT|
|
|
CERTCTL_OPENSSL_TIMEOUT_SECONDS|
|
|
CERTCTL_STEPCA_URL|
|
|
CERTCTL_STEPCA_FINGERPRINT|
|
|
CERTCTL_STEPCA_PROVISIONER|
|
|
CERTCTL_STEPCA_PROVISIONER_NAME|
|
|
CERTCTL_STEPCA_PROVISIONER_KEY|
|
|
CERTCTL_STEPCA_PROVISIONER_JWK|
|
|
CERTCTL_STEPCA_PROVISIONER_PASSWORD|
|
|
CERTCTL_STEPCA_PASSWORD|
|
|
CERTCTL_STEPCA_KEY_PATH|
|
|
CERTCTL_STEPCA_ROOT_CA|
|
|
CERTCTL_WEBHOOK_URL|
|
|
CERTCTL_WEBHOOK_SECRET|
|
|
CERTCTL_ACME_EAB_KID|
|
|
CERTCTL_ACME_EAB_HMAC|
|
|
CERTCTL_ACME_DNS_PROPAGATION_WAIT|
|
|
CERTCTL_AUDIT_EXCLUDE_PATHS|
|
|
CERTCTL_TLS_|
|
|
CERTCTL_TLS_INSECURE_SKIP_VERIFY|
|
|
CERTCTL_SCEP_|
|
|
CERTCTL_SERVER_CA_BUNDLE_PATH|
|
|
CERTCTL_SERVER_TLS_INSECURE_SKIP_VERIFY|
|
|
CERTCTL_QA_[A-Z_]+
|
|
)$'
|
|
# ^ The CERTCTL_OPENSSL_* / CERTCTL_STEPCA_* / CERTCTL_WEBHOOK_* /
|
|
# CERTCTL_ACME_EAB_* / CERTCTL_ACME_DNS_PROPAGATION_WAIT /
|
|
# CERTCTL_AUDIT_EXCLUDE_PATHS / CERTCTL_TLS_* / CERTCTL_SERVER_* /
|
|
# CERTCTL_QA_* sets are documented integration-surface contracts
|
|
# (script invocations, per-issuer config-blob field names,
|
|
# per-notifier config-blob field names, demo-stack overrides,
|
|
# test fixtures) — not server-side env vars in config.go.
|
|
# The audit's "37 docs-only" count over-flagged these; the
|
|
# closure narrows the gate to the specific drift sites
|
|
# (renewal-interval rename + 6 config-only) and allowlists
|
|
# the documented external contracts here.
|
|
ALLOWED_FLAT=$(echo "$ALLOWED" | tr -d '\n ')
|
|
DOCS_ONLY=$(comm -13 /tmp/g3-defined.txt /tmp/g3-docs.txt | grep -vE "$ALLOWED_FLAT" || true)
|
|
CONFIG_ONLY=$(comm -23 /tmp/g3-defined.txt /tmp/g3-docs.txt || true)
|
|
if [ -n "$DOCS_ONLY" ]; then
|
|
echo "::error::G-3 regression: env var(s) mentioned in docs but not defined in Go source AND not in the documented integration-surface allowlist:"
|
|
echo "$DOCS_ONLY"
|
|
echo ""
|
|
echo "Either delete from docs (phantom/typo) or add to config.go,"
|
|
echo "or add to the ALLOWED list with a one-line justification."
|
|
exit 1
|
|
fi
|
|
if [ -n "$CONFIG_ONLY" ]; then
|
|
echo "::error::G-3 regression: env var(s) defined in Go source but never documented:"
|
|
echo "$CONFIG_ONLY"
|
|
echo ""
|
|
echo "Add an entry to docs/features.md (or another canonical doc) so operators can find it."
|
|
exit 1
|
|
fi
|
|
echo "G-3 env-docs-drift: clean."
|