Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Docker BuildKit for the CI and docker_script #1316

Closed
wants to merge 1 commit into from

Conversation

ebeasant-arm
Copy link
Contributor

Docker BuildKit has a number of advanages over the tradiditonal
Docker back end - it's potentially quicker as it can make use of
parallel jobs when multi-stage Dockerfiles are used, and it also
enables the use of automatically set target/host ARGs, such as
TARGETARCH. This is especially useful when working with multiple
target architectures.

(This PR is primarily created to check the functionality of integration with GCP)

Checklist

  • Pull request affects core Oak functionality (e.g. runtime, SDK, ABI)
    • I have written tests that cover the code changes.
    • I have checked that these tests are run by
      Cloudbuild
    • I have updated documentation accordingly.
    • I have raised an issue to
      cover any TODOs and/or unfinished work.
  • Pull request includes prototype/experimental work that is under
    construction.

cloudbuild.yaml Outdated
@@ -20,6 +20,11 @@ steps:
'--tag=gcr.io/oak-ci/oak:latest',
'.',
]
env:
[
"DOCKER_BUILDKIT=1",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(nit) we seem to be using single-quoted string elsewhere, so perhaps worth sticking with that convention (it may even be enforced by some linters already, not sure)

cloudbuild.yaml Outdated
@@ -20,6 +20,11 @@ steps:
'--tag=gcr.io/oak-ci/oak:latest',
'.',
]
env:
[
"DOCKER_BUILDKIT=1",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you also add a short comment here to explain what this is for, and / or a reference to some online page.

Dockerfile Outdated
ARG debian_snapshot=buster-20200327
FROM debian/snapshot:${debian_snapshot}
ARG debian_snapshot=buster-20200720-slim
FROM debian:${debian_snapshot}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note that this is not a snapshot image, in particular AFAICT apt-get packages are not guaranteed to be reproducibly installable. Is there no way to make it work with a (perhaps more recent) snapshot image?

Copy link
Contributor Author

@ebeasant-arm ebeasant-arm Aug 3, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm - By 'snapshot' in this case, I'm guessing that you meant that the base image has the apt sources that are preconfigured to point at the snapshot.debian.org locations? I'll try and tidy this up to be consistent - and find a later snapshot that has the apropriate image in Docker.io so that the cache can be populated.

Dockerfile Outdated
@@ -1,6 +1,6 @@
# Use fixed snapshot of Debian to create a deterministic environment.
# Snapshot tags can be found at https://hub.docker.com/r/debian/snapshot/tags
ARG debian_snapshot=buster-20200327
ARG debian_snapshot=buster-20200720
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looking at it again, it seems that the build step is rebuilding the entire image, presumably because the base image was changed here. Does it not work by keeping it to the old value?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After some research: It does rebuild the whole image if the docker back end is changed (e.g. to BuildKit), but the pull of the original image fails, partially because it doesnt exist any more (so it seems), so I changed that parameter to the currently available image from Docker.io. It looks like the gcb infrastructure hasnt got that image available either, and therfore it fails. BuildKit builds do seem to work (I have it enabled by default on my x86 and the packet machine), but for some reason the CI here has a kink in it...

@ebeasant-arm
Copy link
Contributor Author

Looks to be blocked by a BuildKit problem: If the gcr default mirror can be pre-populated with the Oak snapshot, that would enable this to PR to proceede, or an updated Docker + Buildkit version for gcr (seems unlikely) Related bugfix: moby/buildkit#1397

@ebeasant-arm ebeasant-arm added enhancement New feature or request WIP Work in progress labels Sep 3, 2020
@ebeasant-arm ebeasant-arm self-assigned this Sep 3, 2020
@ebeasant-arm ebeasant-arm marked this pull request as draft September 3, 2020 08:12
Docker BuildKit has a number of advanages over the tradiditonal
Docker back end - it's potentially quicker as it can make use of
parallel jobs when multi-stage Dockerfiles are used, and it also
enables the use of automatically set target/host ARGs, such as
TARGETARCH. This is especially useful when working with multiple
target architectures.

This change modifies the main docker image name to indicate it is
using BuildKit. This is a WIP testing change.
@tiziano88
Copy link
Collaborator

Replaced by #2552

@tiziano88 tiziano88 closed this Feb 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes enhancement New feature or request WIP Work in progress
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants