Skip to content

ci(deploy): auto-deploy on push to master#32

Merged
mastermanas805 merged 1 commit into
masterfrom
ci/auto-deploy-on-master
May 15, 2026
Merged

ci(deploy): auto-deploy on push to master#32
mastermanas805 merged 1 commit into
masterfrom
ci/auto-deploy-on-master

Conversation

@mastermanas805
Copy link
Copy Markdown
Member

Why

A worker code fix shipped to master but was never deployed because someone had to manually run docker buildx build && kubectl set image. A user received the same broken expiry email twice as a result. This is the repo where the bug happened — auto-deploy here is the highest-priority fix.

After this lands, the in-flight expiry-email fix (currently shipping via a separate manual agent push) will auto-propagate on its merge commit.

What it does

On every push to master:

  1. Checks out worker + sibling common/ + proto/ to match Dockerfile context.
  2. Runs go test ./... -short -count=1fails the deploy on red tests.
  3. Builds linux/amd64 with GIT_SHA=<short>, BUILD_TIME=<utc>, VERSION=master-<short>.
  4. Pushes to ghcr.io/mastermanas805/instant-worker:<version> + :latest.
  5. kubectl set image deployment/instant-worker -n instant-infra worker=<image> + rollout status --timeout=180s.
  6. Verifies the deployment now references the exact tag we built.
  7. Shells into the new Ready pod and curls localhost:8091/healthz to confirm commit_id matches (best-effort — see gotcha below).

Concurrency group deploy-Deploy with cancel-in-progress: false so two merges in a row queue instead of racing.

Operator action required before this can fire green

Add KUBECONFIG_B64 to repo Settings → Secrets → Actions. Value = base64 -i ~/.kube/config. Without it the kubeconfig step fails fast with a clear error.

The kubeconfig must have permission to set image on deployment/instant-worker -n instant-infra.

Notes / gotchas

  • Existing ci.yml triggers on main but the repo's default branch is master — pre-existing.
  • The worker image is gcr.io/distroless/static-debian12no shell, no curl, no wget. The in-pod /healthz SHA check is therefore best-effort and downgrades to a warning if it can't exec. The load-bearing gate is step 6 (image tag matches what we built) plus rollout status confirming Ready.
  • The worker k8s deployment is single-container.

Test plan

  • Add KUBECONFIG_B64 repo secret
  • Merge this PR
  • Confirm a fresh commit on master triggers the workflow
  • Confirm kubectl get deployment instant-worker -n instant-infra -o jsonpath='{.spec.template.spec.containers[0].image}' matches the new tag
  • Bonus: watch in-flight expiry-email fix auto-propagate on its next merge

DO NOT MERGE until KUBECONFIG_B64 is in place.

Co-Authored-By: Claude Opus 4.7 (1M context) noreply@anthropic.com

A worker fix shipped to master but never deployed because someone had
to run `docker buildx build && kubectl set image` by hand. A user got
the same broken expiry email twice as a result. Close that gap — for
the worker repo, that's literally how the bug happened.

On every push to master this workflow now:
  1. checks out worker + sibling common/ + proto/ to match Dockerfile
  2. runs `go test ./... -short -count=1` (fails the job on red tests)
  3. builds linux/amd64 with GIT_SHA/BUILD_TIME/VERSION build-args
  4. pushes ghcr.io/mastermanas805/instant-worker:<master-SHA> + :latest
  5. kubectl set image deployment/instant-worker + rollout status (180s)
  6. verifies the deployment now points at the exact tag we built
  7. shells into the new pod and curls localhost:8091/healthz to confirm
     the binary reports the new commit_id (best-effort; the prod image
     is distroless and may not have curl/wget, in which case the
     image-tag check above is the load-bearing gate)

Operator action: add KUBECONFIG_B64 to repo secrets (base64-encoded
kubeconfig). Without it the kubeconfig step fails fast with a clear
error message.

Concurrency group `deploy-Deploy` with cancel-in-progress=false so
two merges in a row queue instead of racing.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@mastermanas805 mastermanas805 merged commit 21ccbb3 into master May 15, 2026
@mastermanas805 mastermanas805 deleted the ci/auto-deploy-on-master branch May 15, 2026 06:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant