Skip to content

Commit 222fb45

Browse files
authoredNov 8, 2024··
fix: use BuildKit instead of legacy builder to build the Hermetic Build images (#3338)
Fixes the following error: ![image](https://github.com/user-attachments/assets/c4d20cbc-e3b3-48d6-9846-896854145857) [Docker Buildkit](https://docs.docker.com/build/buildkit/) is a more advanced version and more actively maintained. We confirmed locally that the error occurs with an old version of the docker builder and that it is fixed when using `DOCKER_BUILDKIT=1`
1 parent b0adcf9 commit 222fb45

File tree

4 files changed

+5
-3
lines changed

4 files changed

+5
-3
lines changed
 

‎.cloudbuild/library_generation/cloudbuild-library-generation-push-prod.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ steps:
3030
"--file", ".cloudbuild/library_generation/library_generation.Dockerfile", "."]
3131
id: library-generation-build
3232
waitFor: ["-"]
33+
env:
34+
- 'DOCKER_BUILDKIT=1'
3335

3436
options:
3537
logging: CLOUD_LOGGING_ONLY

‎.cloudbuild/library_generation/cloudbuild-library-generation-push.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ steps:
3030
"--file", ".cloudbuild/library_generation/library_generation.Dockerfile", "."]
3131
id: library-generation-build
3232
waitFor: ["-"]
33+
env:
34+
- 'DOCKER_BUILDKIT=1'
3335

3436
options:
3537
logging: CLOUD_LOGGING_ONLY

‎hermetic_build/DEVELOPMENT.md

-3
Original file line numberDiff line numberDiff line change
@@ -167,9 +167,6 @@ python hermetic_build/library_generation/cli/entry_point.py generate \
167167
```
168168
Please note that the build only works when using the new
169169
[Docker BuildKit](https://docs.docker.com/build/buildkit/) (enabled through the `DOCKER_BUILDKIT` variable).
170-
This is meant for local development only (in CloudTops) - GH Actions' Ubuntu-22.04 \
171-
[comes with the latest Docker version](https://github.com/actions/runner-images/blob/e74605cd6d5407469cf224802f25057bafc23d70/images/ubuntu/Ubuntu2204-Readme.md?plain=1#L81-L83)
172-
and is able to handle the build properly using the (updated) legacy builder.
173170

174171
3. Set the version of gapic-generator-java
175172

‎hermetic_build/library_generation/tests/integration_tests.py

+1
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,7 @@ def __build_image(cls, docker_file: str, cwd: str):
202202
subprocess.check_call(
203203
["docker", "build", "-f", docker_file, "-t", image_tag, "."],
204204
cwd=cwd,
205+
env=dict(os.environ, DOCKER_BUILDKIT="1"),
205206
)
206207

207208
@classmethod

0 commit comments

Comments
 (0)
Please sign in to comment.