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

Conversation

LorbusChris
Copy link
Contributor

@LorbusChris LorbusChris commented Jun 7, 2021

This commit adds a Google Cloud Build definition for building alpine
arm64 images and pushing them as a manifest list together with their
amd64 counterparts.

This is a prereq for #16588 and #22362

Blocked on: #22599

/cc @stevekuznetsov

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jun 7, 2021
@k8s-ci-robot
Copy link
Contributor

Hi @LorbusChris. Thanks for your PR.

I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. area/images sig/testing Categorizes an issue or PR as relevant to SIG Testing. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jun 7, 2021
@petr-muller
Copy link
Member

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jun 7, 2021
@LorbusChris
Copy link
Contributor Author

/cc @BenTheElder

@k8s-ci-robot k8s-ci-robot requested a review from BenTheElder June 8, 2021 14:32
@LorbusChris
Copy link
Contributor Author

looking at the file history, @fejta might be best suited for a review of these changes.
/cc @fejta
/uncc @BenTheElder

@k8s-ci-robot k8s-ci-robot requested review from fejta and removed request for BenTheElder June 9, 2021 12:07
@spiffxp
Copy link
Member

spiffxp commented Jun 10, 2021

/cc
I'm going to guess this will fail in the same way as #22450 (comment)

EDIT: yeah, it fails

Starting Step #1
Step #1: Already have image (with digest): gcr.io/cloud-builders/docker
Step #1: Sending build context to Docker daemon  5.632kB
Step #1: Step 1/4 : FROM alpine:latest
Step #1:  ---> 6dbb9cc54074
Step #1: Step 2/4 : ARG IMAGE_ARG
Step #1:  ---> Using cache
Step #1:  ---> 8721f6f4cec6
Step #1: Step 3/4 : ENV IMAGE=${IMAGE_ARG}
Step #1:  ---> Running in c37512c3b071
Step #1: Removing intermediate container c37512c3b071
Step #1:  ---> 147b6460c43f
Step #1: Step 4/4 : RUN apk add --no-cache ca-certificates && update-ca-certificates
Step #1:  ---> Running in 7e63302ac69c
Step #1: fetch https://dl-cdn.alpinelinux.org/alpine/v3.13/main/x86_64/APKINDEX.tar.gz
Step #1: fetch https://dl-cdn.alpinelinux.org/alpine/v3.13/community/x86_64/APKINDEX.tar.gz
Step #1: (1/1) Installing ca-certificates (20191127-r5)
Step #1: Executing busybox-1.32.1-r6.trigger
Step #1: Executing ca-certificates-20191127-r5.trigger
Step #1: OK: 6 MiB in 15 packages
Step #1: WARNING: ca-certificates.crt does not contain exactly one certificate or CRL: skipping
Step #1: Removing intermediate container 7e63302ac69c
Step #1:  ---> c75db636ff48
Step #1: [Warning] One or more build-args [ARCH] were not consumed
Step #1: Successfully built c75db636ff48
Step #1: Successfully tagged gcr.io/k8s-staging-test-infra/alpine:v20210610-54b097ac3e-arm64
Finished Step #1
Starting Step #2
Step #2: Already have image (with digest): gcr.io/cloud-builders/docker
Step #2: no such manifest: gcr.io/k8s-staging-test-infra/alpine:v20210610-54b097ac3e
Finished Step #2
ERROR
ERROR: build step 2 "gcr.io/cloud-builders/docker" failed: step exited with non-zero status: 1

@k8s-ci-robot k8s-ci-robot requested a review from spiffxp June 10, 2021 16:03
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jun 15, 2021
@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jun 15, 2021
@LorbusChris LorbusChris changed the title images/alpine: Build for arm64 WIP: images/alpine: Build for arm64 Jun 15, 2021
@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 15, 2021
@LorbusChris LorbusChris changed the title WIP: images/alpine: Build for arm64 images/alpine: Build for arm64 Jun 18, 2021
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 18, 2021
@LorbusChris
Copy link
Contributor Author

#22599 has landed. This PR should be ready now.

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

@LorbusChris
Copy link
Contributor Author

/hold
using the --tag flag twice in one command doesn't seem to work and will actually only tag the latter

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jun 18, 2021
This commit switches the builder base image used for building the alpine
image to `gcr.io/k8s-testimages/gcb-docker-gcloud` in order to do
multi-arch (amd64 and arm64) builds via `docker buildx build`, yielding
a multi-arch manifest.
@LorbusChris
Copy link
Contributor Author

Thanks @BenTheElder, let's go the easy way with gcloud as that's in the image already.
Should be fixed now.
/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jun 18, 2021
Copy link
Member

@BenTheElder BenTheElder left a comment

Choose a reason for hiding this comment

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

lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 18, 2021
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: BenTheElder, LorbusChris

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 18, 2021
@k8s-ci-robot k8s-ci-robot merged commit 2814345 into kubernetes:master Jun 18, 2021
@k8s-ci-robot k8s-ci-robot added this to the v1.22 milestone Jun 18, 2021
@LorbusChris
Copy link
Contributor Author

@LorbusChris
Copy link
Contributor Author

#22609

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/images cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. sig/testing Categorizes an issue or PR as relevant to SIG Testing. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants