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

add multi-arch support to images/alpine #18189

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 46 additions & 5 deletions images/alpine/cloudbuild.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,60 @@
steps:
# Step 1: Set up multiarch support.
- name: gcr.io/cloud-builders/docker
args:
- run
- --privileged
- multiarch/qemu-user-static
- --reset -p yes

# Step 2: Create buildx builder.
- name: gcr.io/cloud-builders/docker
env:
- DOCKER_CLI_EXPERIMENTAL=enabled
args:
- buildx
- create
- --use
- --name=k8s-testimages

# Step 3: Build multi-arch images, then push.
- name: gcr.io/cloud-builders/docker
env:
- DOCKER_CLI_EXPERIMENTAL=enabled
args:
- buildx
- build
fejta marked this conversation as resolved.
Show resolved Hide resolved
- --platform=linux/amd64,linux/arm64,linux/ppc64le,linux/s390x
- --push
- -t
- gcr.io/$PROJECT_ID/alpine:$_GIT_TAG
- --build-arg=IMAGE_ARG=gcr.io/$PROJECT_ID/alpine:$_GIT_TAG
- --pull
- .
dir: .

- name: gcr.io/cloud-builders/docker
env:
- DOCKER_CLI_EXPERIMENTAL=enabled
args:
- tag
- gcr.io/$PROJECT_ID/alpine:$_GIT_TAG
- buildx
- build
- --platform=linux/amd64,linux/arm64,linux/ppc64le,linux/s390x
- --push
- -t
- gcr.io/$PROJECT_ID/alpine:latest
- --build-arg=IMAGE_ARG=gcr.io/$PROJECT_ID/alpine:latest
- --pull
- .
dir: .

substitutions:
_GIT_TAG: '12345'
images:
- 'gcr.io/$PROJECT_ID/alpine:$_GIT_TAG'
Copy link
Contributor

Choose a reason for hiding this comment

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

Please preserve the expected images to publish.

Copy link
Author

@lubinsz lubinsz Jul 8, 2020

Choose a reason for hiding this comment

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

Hi,
In step 3, those images with fat-manifest will be pushed into registry with 'buildx --push' parameter .
I have tested the build methods(make & prowjob) with my private gcloud account, the multi-arch images can be pushed into my private gcloud registry automatically.

On the other hand, we can't load the multi-arch images into the local docker daemon with 'buildx --load' parameter .
Please see the issue as reference:
docker/buildx#59
If we keep this images field, the builder will report an error

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks, this is my first experience with buildx and multiarch images (thanks so much for working on this).

And if the push fails then the build fails? How about then adding a comment at the bottom about what images we expect this to push and why we don't use cloud build's auto verification?

Copy link
Contributor

@lubinszARM lubinszARM Jul 8, 2020

Choose a reason for hiding this comment

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

And if the push fails then the build fails?

Yes.

How about then adding a comment at the bottom about what images we expect this to push and why we don't use cloud build's auto verification?

The comment has been added.

- 'gcr.io/$PROJECT_ID/alpine:latest'

# Expected multi-arch images:
# gcr.io/$PROJECT_ID/alpine:$_GIT_TAG with multi-arch manifest.
# gcr.io/$PROJECT_ID/alpine:latest with multi-arch manifest.
# Notice:
# Multi-arch images can't be loaded into the local docker daemon with 'buildx --load' parameter.
# The feature should get support for loading multi-arch with moby/moby#38738.
# So the images field can not be used for the multi-arch case.