11# Internal reusable workflow for building a non-OSS ("cloud") Docker image and
22# pushing it to Amazon ECR.
3- #
4- # Unlike _build.yml (which builds the public, multi-platform OSS image for GHCR),
5- # this workflow bakes environment-specific configuration into the image — Sentry
6- # DSNs, the Sentry environment name — and uploads source maps to Sentry. Those
7- # values come from the GitHub Environment named by `environment`, so a new
8- # deployment environment is a new Environment plus a small caller workflow.
9- #
10- # Each environment publishes to its own ECR repository, `sourcebot-<environment>`,
11- # owned by CicdStack in the sourcebot-demo-infra repo.
12- #
13- # Single-platform (linux/amd64): the EKS `general-purpose` NodePool that runs
14- # Sourcebot pins `kubernetes.io/arch: amd64`. Building one platform lets us push
15- # tags directly, skipping the push-by-digest + manifest-merge dance _build.yml
16- # needs. It also avoids ECR lifecycle rules for untagged images silently deleting
17- # a manifest list's per-platform children.
18-
193name : Build Cloud Image
204
215on :
4226jobs :
4327 build :
4428 runs-on : ubuntu-latest
45- # Gates the job on the Environment's protection rules, and — because the
46- # OIDC subject for a job with an environment is
47- # `repo:<org>/<repo>:environment:<name>` — is what the ECR push role's trust
48- # policy matches on. Also what makes `vars`/`secrets` below resolve.
4929 environment : ${{ inputs.environment }}
5030 permissions :
5131 contents : read
@@ -60,16 +40,10 @@ jobs:
6040 submodules : " true"
6141 fetch-depth : 0
6242
63- # The exact commit built. `github.sha` is the SHA of the ref the workflow
64- # was *dispatched* on, which is not necessarily `git_ref`.
6543 - name : Resolve build commit SHA
6644 id : commit
6745 run : echo "sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT"
6846
69- # Fail fast, and loudly. The Dockerfile only uploads source maps when every
70- # Sentry input is non-empty, so a missing var or secret would otherwise
71- # produce a perfectly green build of an image with no Sentry wiring. Values
72- # are never printed — only whether each resolved to something.
7347 - name : Validate environment configuration
7448 env :
7549 SENTRY_AUTH_TOKEN : ${{ secrets.SENTRY_AUTH_TOKEN }}
0 commit comments