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

images/alpine: Build for arm64 #22444

Merged
merged 1 commit into from
Jun 18, 2021
Merged
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
18 changes: 10 additions & 8 deletions images/alpine/cloudbuild.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
steps:
- name: gcr.io/cloud-builders/docker
- name: gcr.io/k8s-testimages/gcb-docker-gcloud
entrypoint: /buildx-entrypoint
args:
- build
- -t
- gcr.io/$PROJECT_ID/alpine:$_GIT_TAG
- --tag=gcr.io/$PROJECT_ID/alpine:$_GIT_TAG
- --platform=linux/amd64,linux/arm64/v8
- --build-arg=IMAGE_ARG=gcr.io/$PROJECT_ID/alpine:$_GIT_TAG
- --push
- .
dir: .
- name: gcr.io/cloud-builders/docker
- name: gcr.io/k8s-testimages/gcb-docker-gcloud
entrypoint: gcloud
args:
- tag
- container
- images
- add-tag
- gcr.io/$PROJECT_ID/alpine:$_GIT_TAG
- gcr.io/$PROJECT_ID/alpine:latest
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.

What is the reason for dropping these? (or rather moving pushing them into the build step)
https://cloud.google.com/build/docs/build-config#images

Copy link
Contributor Author

@LorbusChris LorbusChris Jun 18, 2021

Choose a reason for hiding this comment

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

This doesn't seem to work with manifest lists.
Using:

steps:
  - name: gcr.io/k8s-testimages/gcb-docker-gcloud
    entrypoint: /buildx-entrypoint
    args:
    - build
    - --tag=gcr.io/$PROJECT_ID/alpine:$_GIT_TAG
    - --tag=gcr.io/$PROJECT_ID/alpine:latest
    - --platform=linux/amd64,linux/arm64/v8
    - --build-arg=IMAGE_ARG=gcr.io/$PROJECT_ID/alpine:$_GIT_TAG
    - .
    dir: .
substitutions:
  _GIT_TAG: '12345'
images:
  - 'gcr.io/$PROJECT_ID/alpine:$_GIT_TAG'
  - 'gcr.io/$PROJECT_ID/alpine:latest'

yields:

ERROR: failed to find one or more images after execution of build steps: ["gcr.io/k8s-staging-test-infra/alpine:v20210618-1bc5e9d8bf" "gcr.io/k8s-staging-test-infra/alpine:latest"]

Copy link
Member

@BenTheElder BenTheElder Jun 18, 2021

Choose a reason for hiding this comment

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

GCR specific but cheap and simple gcloud container images add-tag.

To do it generically you'd need to push the manifest again as a tag (and only the manifest, the underlying resources should already be pushed), crane can do this (and other super useful things!) see: crane tag

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