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
Fixed the Dockerfile for the build-image to build from KUBE_BASE_IMAGE_REGISTRY #99592
Fixed the Dockerfile for the build-image to build from KUBE_BASE_IMAGE_REGISTRY #99592
Conversation
Thanks for your pull request. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please follow instructions at https://git.k8s.io/community/CLA.md#the-contributor-license-agreement to sign the CLA. It may take a couple minutes for the CLA signature to be fully registered; after that, please reply here with a new comment and we'll verify. Thanks.
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. I understand the commands that are listed here. |
Welcome @Joseph-Goergen! |
Hi @Joseph-Goergen. 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 Once the patch is verified, the new status will be reflected by the 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. |
Thanks for the PR! We're going to need the CLA sorted out #99592 (comment) to merge, but at a quick glance this change looks good otherwise. |
build/common.sh
Outdated
@@ -394,7 +394,7 @@ function kube::build::docker_build() { | |||
local -r context_dir=$2 | |||
local -r pull="${3:-true}" | |||
local -r build_args=$4 | |||
local -ra build_cmd=("${DOCKER[@]}" build -t "${image}" "--pull=${pull}" "${build_args}" "${context_dir}") | |||
local -ra build_cmd=("${DOCKER[@]}" build -t "${image}" "--pull=${pull}" ${build_args[@]} "${context_dir}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should still be quoted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've tried it quoted and it breaks. I think it's a glitch in how docker parses out parameters? If it's quoted, docker enforces it as a single parameter when there are actually multiple.
$ ./build/release.sh
+++ [0301 17:33:31] Verifying Prerequisites....
+++ [0301 17:33:35] Building Docker image kube-build:build-5f7bbf6510-5-v1.15.8-1
+++ Docker build command failed for kube-build:build-5f7bbf6510-5-v1.15.8-1
Sending build context to Docker daemon 8.704kB
Step 1/18 : ARG KUBE_BUILD_IMAGE_CROSS_TAG
Step 2/18 : ARG KUBE_BASE_IMAGE_REGISTRY
Step 3/18 : FROM ${KUBE_BASE_IMAGE_REGISTRY}/kube-cross:${KUBE_BUILD_IMAGE_CROSS_TAG}
invalid reference format
To retry manually, run:
docker build -t kube-build:build-5f7bbf6510-5-v1.15.8-1 --pull=false --build-arg=KUBE_BUILD_IMAGE_CROSS_TAG=v1.15.8-1 --build-arg=KUBE_BASE_IMAGE_REGISTRY=<redacted> /home/vagrant/kubernetes/_output/images/kube-build:build-5f7bbf6510-5-v1.15.8-1
!!! [0301 17:33:36] Call tree:
!!! [0301 17:33:36] 1: ./build/release.sh:35 kube::build::build_image(...)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@BenTheElder Doing it with quotes actually runs the docker build command like
++ docker build -t kube-build:build-5f7bbf6510-5-v1.15.8-1 --pull=false '--build-arg=KUBE_BUILD_IMAGE_CROSS_TAG=v1.15.8-1 --build-arg=KUBE_BASE_IMAGE_REGISTRY=<redacted>/build-image' /home/vagrant/kubernetes/_output/images/kube-build:build-5f7bbf6510-5-v1.15.8-1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I got it fixed for adding the quotes. Basically had to ensure build_args
was received as a array, not just a string
f8d81df
to
eb97c6a
Compare
eb97c6a
to
d765fcd
Compare
/retest |
d765fcd
to
59d5701
Compare
/test pull-kubernetes-cross |
build/common.sh
Outdated
@@ -393,8 +393,9 @@ function kube::build::docker_build() { | |||
local -r image=$1 | |||
local -r context_dir=$2 | |||
local -r pull="${3:-true}" | |||
local -r build_args=$4 | |||
local -ra build_cmd=("${DOCKER[@]}" build -t "${image}" "--pull=${pull}" "${build_args}" "${context_dir}") | |||
# shellcheck disable=SC2206 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Disable lint should have a comment about why we disabled it.
We could instead choose here to read to an array splitting on space explicitly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright, I went into the shell check docs to get a workaround. It might be a little messy because I had to make the variable local first and then set the value then make it readonly. If you have a suggestion for a better way, let me know
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a comment would be OK, or we can do something like:
Line 800 in 23af91b
# kube::util::read-array files < <(ls -1) |
(sorry, I should have suggested something more concrete last night!)
One remaining nit. Thanks for the PR and sorry for the slow review cycle ... |
59d5701
to
4d44088
Compare
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: BenTheElder, Joseph-Goergen 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 |
Sorry we missed the deadline for code freeze (especially heavy review load around then...), I don't think this qualifies as a release blocking bugfix, so it will probably merge when we open up for 1.22 development. (though at least it's relatively unlikely anything else will merge to this file between now and then so hopefully it should merge without further effort) |
@BenTheElder Just wondering, when this does merge (after the code-freeze), is it possible to cherry-pick this into the 1.21 release branch? |
It's possible but ultimately up to the branch manager and they're generally looking for critical bugs https://github.com/kubernetes/community/blob/master/contributors/devel/sig-release/cherry-picks.md I'll get a second opinion on merging this during freeze. I'd like to see this in but my read of the freeze guidelines doesn't cover a change like this. |
/test pull-kubernetes-cross |
/milestone v1.21 |
We discussed this in kubernetes #release-management slack and the relevant owners agreed to grant this one for 1.21, thanks all! This should merge shortly, with any luck. |
Hey @BenTheElder , just wondering if we can get this cherry-picked into the 1.18, 1.19 and 1.20 release branches? |
It's possible but it will be at the discretion of the branch managers, this doc covers the expectations / process Kubernetes uses and the tooling we have to help: |
related: https://github.ibm.com/alchemy-containers/armada-update/issues/1791
What type of PR is this?
/kind bug
What this PR does / why we need it:
Fixes building kube images based on KUBE_BASE_IMAGE_REGISTRY environment variable
Which issue(s) this PR fixes:
Fixes #
#99238
Special notes for your reviewer:
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: