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

Switch to docker buildx for conformance image #98569

Merged
merged 1 commit into from Jan 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion cluster/images/conformance/Dockerfile
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

FROM --platform=linux/ARCH BASEIMAGE
FROM BASEIMAGE

COPY ginkgo /usr/local/bin/
COPY e2e.test /usr/local/bin/
Expand Down
9 changes: 7 additions & 2 deletions cluster/images/conformance/Makefile
Expand Up @@ -54,9 +54,14 @@ endif
chmod a+rx ${TEMP_DIR}/e2e.test
chmod a+rx ${TEMP_DIR}/gorunner

cd ${TEMP_DIR} && sed -i.back "s|ARCH|${ARCH}|g; s|BASEIMAGE|${BASEIMAGE}|g" Dockerfile
cd ${TEMP_DIR} && sed -i.back "s|BASEIMAGE|${BASEIMAGE}|g" Dockerfile

docker build --pull -t ${REGISTRY}/conformance-${ARCH}:${VERSION} ${TEMP_DIR}
docker buildx build \
Copy link
Member

Choose a reason for hiding this comment

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

  • where is buildx being initialized in the case that the host does not have it initialized already?
  • we're not setting the DOCKER_CLI_EXPERIMENTAL=enabled anywhere that I see either?

Copy link
Member Author

Choose a reason for hiding this comment

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

  • where is buildx being initialized in the case that the host does not have it initialized already?

Currently nowhere, we have an init-buildx.sh script in k/release which could be vendored over here: https://github.com/kubernetes/release/blob/master/hack/init-buildx.sh

Do we wanna do that?

  • we're not setting the DOCKER_CLI_EXPERIMENTAL=enabled anywhere that I see either?

Same as above, the CI / release process right now ensures that it is set. Following docker versions will set it per default as well: https://github.com/docker/cli/blob/e31e00585363e6a989e37fa92cf06481ea218344/docs/deprecated.md#configuration-options-for-experimental-cli-features

Anyways, we can still add it to the build scripts, which should not hurt.

Copy link
Contributor

Choose a reason for hiding this comment

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

@saschagrunert Related: looks like we are not setting it currently in the build canary (https://prow.k8s.io/view/gcs/kubernetes-jenkins/logs/ci-kubernetes-build-canary/1355584153801723904)

Do you want to go ahead and handle setup in k/k or try to just fix jobs in intermediate?

Copy link
Member

Choose a reason for hiding this comment

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

Currently nowhere, we have an init-buildx.sh script in k/release which could be vendored over here: https://github.com/kubernetes/release/blob/master/hack/init-buildx.sh

well I'd say yes, but the original source for that is in fact:
https://github.com/kubernetes-sigs/kind/commits/master/hack/build/init-buildx.sh
🙃

Without this, you can't consistently rely on there being a builder provisioned, causing builds to fail on clean hosts (except on docker desktop, where there's one provided OOTB).

--platform linux/${ARCH} \
--load \
--pull \
Copy link
Contributor

Choose a reason for hiding this comment

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

@saschagrunert are we not concerned about the base image caching issue that previously broke this when switching to buildx? (see #97982 for more info)

Copy link
Member Author

Choose a reason for hiding this comment

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

Just a bit (?) 😇

I tested it right now and it seems to work:
https://console.cloud.google.com/cloud-build/builds/478d0c13-4dfc-4f0c-9d82-5fff0708c810?project=kubernetes-release-test

Can you share some more insights which error cases we might face?

Copy link
Contributor

Choose a reason for hiding this comment

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

@saschagrunert we were previously hitting a bug with the base image not being cached on registry mirror, but it is possible that issue has been addressed on GCR side (#92042) 👍

Copy link
Member

Choose a reason for hiding this comment

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

this is also addressed on the buildx side going forward (should fallback to the non mirror endpoint like docker build does), thought it may be some time before we're using the patched version.

-t ${REGISTRY}/conformance-${ARCH}:${VERSION} \
${TEMP_DIR}
rm -rf "${TEMP_DIR}"

push: build
Expand Down