fix: use BuildKit instead of legacy builder to build the Hermetic Bui… · googleapis/sdk-platform-java@222fb45

4 files changed

lines changed

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

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

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
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