5151 # tags.
5252 kind=image
5353 case "${TAG}" in
54+ api-v*)
55+ # api releases as one unit with the infra db-migrator: its
56+ # docker-bake.hcl builds both images (the api bakes in the
57+ # migration timestamp its startup guard expects, the migrator
58+ # bakes in the migrations, so one shared version makes schema
59+ # skew impossible). Both images land in the single `api`
60+ # registry repo (e2b-artifacts/api/api and
61+ # e2b-artifacts/api/db-migrator), which also avoids colliding
62+ # with belt's separate db-migrator repo.
63+ component=api
64+ kind=bake
65+ ;;
5466 docker-reverse-proxy-v*)
5567 component=docker-reverse-proxy
5668 # Build context is packages/ (the Dockerfile needs shared/ and db/).
7587 context=packages/clickhouse
7688 build_args=""
7789 ;;
90+ dashboard-api-v*)
91+ component=dashboard-api
92+ # Build context is packages/ (the Dockerfile needs shared/).
93+ dockerfile=packages/dashboard-api/Dockerfile
94+ context=packages
95+ build_args="COMMIT_SHA EXPECTED_MIGRATION_TIMESTAMP"
96+ ;;
7897 envd-v*)
7998 # envd is a raw static binary (CGO_ENABLED=0), not an image:
8099 # published as a versioned object in the public
@@ -84,6 +103,28 @@ jobs:
84103 component=envd
85104 kind=binary
86105 ;;
106+ orchestrator-v*)
107+ # One release covers all three fc-env-pipeline binaries built
108+ # from packages/orchestrator: `make build` produces bin/
109+ # orchestrator and bin/clean-nfs-cache, and template-manager IS
110+ # the orchestrator binary uploaded under a second object name
111+ # (see the package Makefile's upload/template-manager), so no
112+ # separate template-manager object is published. The Makefile's
113+ # ORCHESTRATOR_VERSION flow downloads these and uploads them to
114+ # the client's fc-env-pipeline bucket under the usual names.
115+ component=orchestrator
116+ kind=binary
117+ binary_files="orchestrator clean-nfs-cache"
118+ ;;
119+ nomad-nodepool-apm-v*)
120+ # Two Nomad plugin binaries built and released together from
121+ # one package; the Makefile's NOMAD_NODEPOOL_APM_VERSION flow
122+ # downloads both and uploads them to the client's
123+ # fc-env-pipeline bucket under the usual names.
124+ component=nomad-nodepool-apm
125+ kind=binary
126+ binary_files="nomad-nodepool-apm nomad-deployment-aware-target"
127+ ;;
87128 *)
88129 # A stray tag caught by the loose glob is a no-op; an explicit
89130 # dispatch for one is a mistake and should fail loudly.
@@ -117,10 +158,15 @@ jobs:
117158 echo "dockerfile=${dockerfile}"
118159 echo "context=${context}"
119160 echo "build_args=${build_args}"
120- else
121- # <bucket>/<component>/<version>/<binary>
122- echo "binary_uri=gs://e2b-artifact-binaries/${component}/v${version}/${component}"
161+ elif [ "${kind}" = "binary" ]; then
162+ # Versioned directory in the public binaries bucket; most
163+ # binary components ship one file named after the component,
164+ # multi-binary packages (orchestrator) list theirs explicitly.
165+ echo "binary_dir=gs://e2b-artifact-binaries/${component}/v${version}"
166+ echo "binary_files=${binary_files:-${component}}"
123167 fi
168+ # kind=bake needs no extra outputs: the bake step derives its
169+ # registry paths from the component and version.
124170 } >> "${GITHUB_OUTPUT}"
125171
126172 - name : Checkout repository
@@ -147,11 +193,11 @@ jobs:
147193 uses : google-github-actions/setup-gcloud@v3
148194
149195 - name : Configure Docker auth
150- if : ${{ steps.pkg.outputs.kind == 'image' }}
196+ if : ${{ steps.pkg.outputs.kind == 'image' || steps.pkg.outputs.kind == 'bake' }}
151197 run : gcloud auth configure-docker us-docker.pkg.dev --quiet
152198
153199 - name : Set up Docker Buildx
154- if : ${{ steps.pkg.outputs.kind == 'image' }}
200+ if : ${{ steps.pkg.outputs.kind == 'image' || steps.pkg.outputs.kind == 'bake' }}
155201 uses : docker/setup-buildx-action@v3
156202
157203 - name : Build and push released image
@@ -177,6 +223,11 @@ jobs:
177223 case "${arg}" in
178224 COMMIT_SHA) args+=( --build-arg COMMIT_SHA="$(git rev-parse --short HEAD)" ) ;;
179225 VERSION) args+=( --build-arg VERSION="${IMAGE_TAG}" ) ;;
226+ # The newest DB migration version in the tagged source — the
227+ # startup migration guard (api, dashboard-api). Derived from
228+ # the checkout, so it matches a from-source build; without it
229+ # the guard is silently disabled (empty parses to 0).
230+ EXPECTED_MIGRATION_TIMESTAMP) args+=( --build-arg EXPECTED_MIGRATION_TIMESTAMP="$(scripts/get-latest-migration.sh)" ) ;;
180231 esac
181232 done
182233 docker buildx build \
@@ -189,6 +240,32 @@ jobs:
189240 -f "${DOCKERFILE}" \
190241 "${CONTEXT}"
191242
243+ # Bake components (kind=bake): api's docker-bake.hcl builds the api and
244+ # db-migrator images together; both are pushed into the `api` registry
245+ # repo under the shared version tag. Tag overrides replace the bake
246+ # file's REGISTRY_PREFIX-derived tags; the migration timestamp is
247+ # computed from the tag's checkout, matching a from-source build.
248+ - name : Build and push released images (bake)
249+ if : ${{ steps.pkg.outputs.kind == 'bake' }}
250+ env :
251+ COMPONENT : ${{ steps.pkg.outputs.component }}
252+ VERSION : ${{ steps.pkg.outputs.version }}
253+ run : |
254+ IMAGE_TAG="v${VERSION}"
255+ REGISTRY="us-docker.pkg.dev/e2b-artifacts/${COMPONENT}"
256+ EXPECTED_MIGRATION_TIMESTAMP="$(scripts/get-latest-migration.sh)"
257+ COMMIT_SHA="$(git rev-parse --short HEAD)"
258+ cd packages
259+ REGISTRY_PREFIX="${REGISTRY}" \
260+ COMMIT_SHA="${COMMIT_SHA}" \
261+ EXPECTED_MIGRATION_TIMESTAMP="${EXPECTED_MIGRATION_TIMESTAMP}" \
262+ docker buildx bake -f "${COMPONENT}/docker-bake.hcl" \
263+ --provenance=false \
264+ --sbom=false \
265+ --set "api.tags=${REGISTRY}/api:${IMAGE_TAG}" \
266+ --set "db-migrator.tags=${REGISTRY}/db-migrator:${IMAGE_TAG}" \
267+ --push
268+
192269 # Binary components (kind=binary): build with the repo Go toolchain and
193270 # upload the versioned object to the public e2b-artifact-binaries
194271 # bucket. The package Makefile's `build` target derives the commit sha
@@ -212,9 +289,13 @@ jobs:
212289 # consumers fetch via
213290 # https://storage.googleapis.com/e2b-artifact-binaries/... — the bucket
214291 # is public-read.
215- - name : Upload released binary
292+ - name : Upload released binaries
216293 if : ${{ steps.pkg.outputs.kind == 'binary' }}
217294 env :
218295 COMPONENT : ${{ steps.pkg.outputs.component }}
219- BINARY_URI : ${{ steps.pkg.outputs.binary_uri }}
220- run : gcloud storage cp "packages/${COMPONENT}/bin/${COMPONENT}" "${BINARY_URI}"
296+ BINARY_DIR : ${{ steps.pkg.outputs.binary_dir }}
297+ BINARY_FILES : ${{ steps.pkg.outputs.binary_files }}
298+ run : |
299+ for f in ${BINARY_FILES}; do
300+ gcloud storage cp "packages/${COMPONENT}/bin/${f}" "${BINARY_DIR}/${f}"
301+ done
0 commit comments