Operational helpers for the EKS-hosted CI platform.
Read-only by default. Most expect AWS_PROFILE=percona-dev-admin and a
kubeconfig with the percona-ci-platform context.
check-master-spot-readiness.sh
Spot-interrupt readiness audit for a Jenkins master.
- SpotFleet has Capacity Rebalancing + pinned to
$Latest - SSM agent online, cloud-init done
crondactive,terminate-checkcron installed and firingjenkins-graceful-stop.shpresent withflockguard,jqavailable- JVM has the rehydrate flag (eks_observability profile)
- Secrets Manager fetch + api-admin auth probe from loopback
Exits non-zero if anything is missing.
runbook.py
Gated runbook automations behind just runbook. One subcommand per
common operation: template-change <inst> is fully automated (clean
origin/main gate, plan-scope gate allowing only that master's
init-config S3 objects, apply, live evaluate via the jenkins CLI),
the rest are guided step-runners with per-step confirmation.
check-master-alloy-mimir.py
Verify every active master ships metrics to Mimir via Alloy. Enumerates the
master set dynamically from repo source-of-truth (k8s instances dir,
master-*.tf with/without the jenkins-master module -> k8s / tf-managed /
cf-managed) and reads per-master freshness of
hetzner_api_rate_limit_remaining from the in-cluster Mimir query-frontend.
--max-age <s>, --json; STALE/MISSING exits non-zero. Run via
just check-master-alloy.
check-master-ingest.sh
Per-master Mimir + Loki ingest probe via in-cluster query-frontends.
Reports series count, sample freshness, metric cardinality, Loki line count.
Use for fleet-wide observability spot-checks without SSH. The master list is
hardcoded (EXPECTED_MASTERS in the script); check-master-alloy-mimir.py
derives it dynamically — pair them.
verify-observability.sh
Per-master end-to-end LGTM push pipeline walk: master-side Alloy systemd,
ALB + bearer, alloy-gateway pods, Mimir distributor + canary, Loki ring +
canary, Grafana. Pair with check-master-ingest.sh for fleet-wide.
check-uptime-queries.py
Validate every jenkins-uptime PromQL query against Mimir (ADR 0031): the
PrometheusRule recording-rule exprs (live from the cluster when deployed,
else rendered via helm template) plus every Jenkins Uptime dashboard
panel expr and its template-variable query. Auto-detects pre-deploy
(addon series may be empty, source series must exist) vs post-deploy
(everything must return series). Parse errors or unexpectedly empty
results exit non-zero.
ps3-aws-stash-reload.groovy
Script Console step for the in-cluster ps3 controller: reads the
percona-ci-platform/jenkins/ps3/aws-stash key pair from Secrets Manager
through Pod Identity and updates the AWS_STASH credential in place. Prints
only the access key id. Run via jenkins admin -i ps3 groovy -f after a key
rotation, see docs/runbooks/ps3-aws-stash.md.
verify-karpenter.sh
Before / during / after validation of Karpenter scale-up, scale-down, and
disruption behavior. Phase-based (--phase scaleup-small | scaledown-empty | all | ...). Fixtures in karpenter-tests/.
verify-lgtm-cutover.sh
Cluster-side LGTM-only migration validation: ruler sync, ALB bearer gate,
worker provisioning telemetry, dashboards, kps removal. The worker phase
triggers a real Jenkins build.
check-dashboard-queries.py
Validate every PromQL expr in any Grafana dashboard JSON (path or URL)
against live Mimir. Walks panels including collapsed rows, resolves the
dashboard's own template variables by running their queries, then runs
each target as an instant query: OK / EMPTY (metric absent) /
EMPTY (selector) / ERROR, with --allow-empty / --allow-empty-ref
for panels legitimately empty when healthy (discards, 5xx overlays).
Generic sibling of check-uptime-queries.py (which also covers the
jenkins-uptime recording rules and pre/post-deploy modes). Spawns its own
port-forward unless --prom-url is given. Run after any dashboard edit;
the gnetId-17781 kill-list evidence and the Loki / Golden Signals gate
both came from this script. Run via uv run scripts/check-dashboard-queries.py.
jenkins-mcp-audit-patterns.py
Tool-calling patterns from the jenkins-mcp audit log in Loki (default 30
days). Dedupes on request_id (raw line counts overcount), groups calls
into sessions, and counts the patterns that cost avoidable calls: hand
fan-out across masters, repeats, build walks, status polling, build-number
discovery after build_item, per-file grep chains, plus errors by class.
Read-only, spawns its own port-forward unless --loki-url is given, and
--jsonl writes the deduped export. Re-run after a gateway release to
measure what a new tool removed.
check_versions.py
Version drift check for pinned tools, charts, AWS CLI. Run before bumping
terraform/versions.tf or addon chart pins.
install-master-observability.sh
Bootstrapped on each EC2 Jenkins master from the TF user-data (SHA-pinned).
Installs amazon-ssm-agent + Grafana Alloy with an ExecStartPre that
fetches the alloy-gateway bearer token from AWS Secrets Manager. The unix
exporter includes the textfile collector on /var/lib/alloy/textfile, where
the engineer-keys sync drops its gauges (ADR 0046). Idempotent.
Not invoked locally; lives here so platform changes to the gateway and the
master-side installer land in one diff.
check_conventions.py
Terraform conventions gate (just tf-conventions, part of just ci): file-naming
grammar, per-team # Owner: banners, and the comment rules (no copyright headers,
no CLAUDE.md refs, no Jira ticket IDs). Stdlib-only, fail-closed.
render-clouds.py
Renders each master's JCasC clouds configScript from the shared clouds catalog.
check <inst> is the CI drift + no-YAML-alias gate (ADR 0029); apply <inst>
rewrites the committed values. Never hand-edit the rendered values.
jenkins-chart-render-check.sh
Renders the per-instance Jenkins controller chart and asserts the values reach the
jenkins subchart (image / Retain PVC / ALB group / ClusterIP agent Service /
node-pool pin). Guards the jenkins:-scoping regression. Run via just helm-render.
refresh-fork-locks.sh
Recorded-pin auto-bump for the ec2 / hetzner-cloud fork plugins: rewrites
images/jenkins/percona-plugins.lock.json to the latest .percona. release
(sha256- and MANIFEST-verified). --check reports only and exits 3 if a bump
exists. Run via just refresh-fork-locks / just check-fork-locks.
- Exit codes:
0all green,1at least one FAIL,2precondition missing. - Output: PASS / FAIL / SKIP rows per stage, summary at end. ANSI on TTY.
- Master argument: shortname (
ps3,pxb, ...) or instance id (i-...).