Eight hundred lines of bash so nobody has to remember which input a workflow wants
Every deploy in the repository is a `gh workflow run` with the right inputs for the right path, and the two paths take different inputs, so I wrote the thing that knows which is which.
Every deploy in the repository is a gh workflow run with the right inputs for the right path, and the two paths take different inputs, so I wrote the thing that knows which is which.
What was missing
All 171 workflow files in the deploy repository are generated from the per-service meta files and marked # infra_core_managed. Dispatching one by hand means holding three facts at once. Is the service Kubernetes or host-deployed; which workflow filename does that imply; and which inputs does that workflow take (image_version for Kubernetes, image_version plus host_groups for a host deploy)? Get the host group wrong on a prod dispatch and Ansible restarts a container on a machine you did not mean to touch (deploys run sequentially, one host at a time, so the first host tells you).
So service-deployer/deploy.sh derives all three from files already in the repo. With no arguments it asks. With list it prints each service's configured version beside its deployed version (config from meta-*.yml, deployed from the orchestrator's own output). The rest is hosts, status, verify and sync. A prod Kubernetes deploy dispatches, polls for the PR (30 attempts, 10 seconds apart), prints gh pr diff inline, then offers merge, open-in-browser or skip.
Four things that broke, in order
Discovery through the API. The first version listed services with the git tree API and read each meta file through the contents API (two endpoints, one call per service). That is a handful of round trips before the script can print a menu. The refactor reads local files and runs git pull --ff-only --quiet once at startup, leaving three calls that genuinely have to be remote (workflow dispatch, run list, inventory sync).
A 22KB inventory piped through a bash variable. fetch_inventory returned the file's contents, and tanker verify died with no message partway through parsing. The fix was to return a path and let sed and awk read the file directly — plus || true on every grep chain, because set -e treats a no-match as a fatal exit.
YAML parsing without yq. The fallback was a grep for host_groups, which collected list items belonging to the following key as well. The symptom was silent; verify printed an empty host list on any machine without yq installed. An awk pass that stops at the first non-list line fixed it (one next, one exit).
An empty deployments/ directory. Deploy type was inferred from which subdirectory existed, which works only after a service has deployed once. A service onboarded that morning had neither, so detection now falls back to which generated workflow files are present (deploy-tanker-<svc>-dev.yml means tanker). One more platform difference: paste on macOS needs an explicit - to read stdin.
Replacing an internal CLI with kubectl
Kubernetes verify originally shelled out to an internal CLI that listed Consul instances. It now reads the namespace out of the generated kustomization.yaml instead of a hardcoded value, and reads cluster contexts from k8s_clusters in the meta file. Only then does it ask kubectl for running pods and their image tags. Host verify tries direct SSH first and falls back to the access manager's config (~/.sdm/ssh_config), printing the running image tag and container status per host.
Gating prod, deliberately
Dev deploys take a change type, title and description if you feel like supplying them (option 0 skips the lot). Prod refuses without all three — the script exits on an empty field — because the orchestrator parses them into a conventional-commit PR title, the Slack changelog and the release notes. That mirrors what the old Jenkins pipeline demanded, which is the point: the migration kept the discipline and dropped the server.
What it was for
Through February 2026 fourteen services came off the Jenkins pipeline into this repository under one ticket, 27 meta files in all (billing, docs, three DRA flavours, four IMS components, log-watcher, messaging-router, pcap-extractor, two STP flavours). Each lands as config only — two files, no manifests written by hand. A single onboarding commit generated 28 new workflow files and updated 2.
The inventory cache syncs daily at 06:00 UTC and opens a PR when the hosts file has changed. It is the one part of this that runs whether anybody deploys that day or not (a scheduled workflow, not a laptop).