Cloud Build doesn't hydrate the BUILDPLATFORM env

Author: olivi-ehCreated Jun 2, 2025Updated Mar 16, 2026
Labelstype: bugpriority: p2

Since https://github.com/GoogleCloudPlatform/microservices-demo/pull/2589 was introduced, it broke the releasing process, though I just noticed now trying to perform a release.

The release build fails with errors like:

Step 1/14 : FROM --platform=$BUILDPLATFORM eclipse-temurin:21.0.5_11-jdk@sha256:a20cfa6afdbf57ff2c4de77ae2d0e3725a6349f1936b5ad7c3d1b06f6d1b840a AS builder
failed to parse platform : "" is an invalid component of "": platform specifier component must match "^[A-Za-z0-9_-]+$": invalid argument

It looks like Cloud Build may support BuildKit but I was not successful in finding a solution to enable BuildKit via gcloud builds submit, which is what the releasing process does: https://github.com/GoogleCloudPlatform/microservices-demo/blob/main/docs/releasing/make-docker-images.sh#L43

As a temporary workaround, to be able to do the latest release (https://github.com/GoogleCloudPlatform/microservices-demo/pull/2983) I had to git revert (and then subsequently git cherry-pick) the commit introducing BUILDPLATFORM (https://github.com/GoogleCloudPlatform/microservices-demo/commit/916eeac8e730f26a5a11d80dba17d65257fa749a)

Source: GoogleCloudPlatform/microservices-demo