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

Check KUBE_SERVER_PLATFORMS emptiness #78059

Merged
merged 1 commit into from May 18, 2019

Conversation

@figo
Copy link
Member

commented May 18, 2019

when compile kubectl on platform other than
linux/amd64, KUBE_SERVER_PLATFORMS will be empty which is expected,
so we need to check the KUBE_SERVER_PLATFORMS array emptiness before use it.

the example command is:
make WHAT=cmd/kubectl KUBE_BUILD_PLATFORMS="darwin/amd64 windows/amd64"

What type of PR is this?
/kind bug

What this PR does / why we need it:

Which issue(s) this PR fixes:
Fixes #78055

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

fix KUBE_SERVER_PLATFORMS null error when cross compiling kubectl for non-linux platform

@cblecker @tpepper @jiatongw @dims @BenTheElder

/sig release

@figo

This comment has been minimized.

Copy link
Member Author

commented May 18, 2019

cc @mtaufen, appreciate if you could review it since you introduced KUBE_SERVER_PLATFORMS

@figo figo changed the title Check KUBE_SERVER_PLATFORMS emptiness before assign it Check KUBE_SERVER_PLATFORMS emptiness May 18, 2019

@jiatongw
Copy link
Member

left a comment

Tested on my 1.14.2 testing branch and it works for command make WHAT=cmd/kubectl KUBE_BUILD_PLATFORMS="darwin/amd64 windows/amd64"

OS: ubuntu 16.04, bash version 4.3

@figo

This comment has been minimized.

Copy link
Member Author

commented May 18, 2019

/test pull-kubernetes-e2e-gce-100-performance

@dims

This comment has been minimized.

Copy link
Member

commented May 18, 2019

@tpepper

This comment has been minimized.

Copy link
Contributor

commented May 18, 2019

Works for me on non-homebrew MacOS, for 1.14.2 plus the other stack of make fixes described in #78048

@@ -292,7 +292,9 @@ kube::golang::server_test_targets() {
IFS=" " read -ra KUBE_TEST_SERVER_TARGETS <<< "$(kube::golang::server_test_targets)"
readonly KUBE_TEST_SERVER_TARGETS
readonly KUBE_TEST_SERVER_BINARIES=("${KUBE_TEST_SERVER_TARGETS[@]##*/}")
readonly KUBE_TEST_SERVER_PLATFORMS=("${KUBE_SERVER_PLATFORMS[@]}")
if [[ -n "${KUBE_SERVER_PLATFORMS:-}" ]]; then
readonly KUBE_TEST_SERVER_PLATFORMS=("${KUBE_SERVER_PLATFORMS[@]}")

This comment has been minimized.

Copy link
@cblecker

cblecker May 18, 2019

Member

Instead of ifs, just change this line to:

Suggested change
readonly KUBE_TEST_SERVER_PLATFORMS=("${KUBE_SERVER_PLATFORMS[@]}")
readonly KUBE_TEST_SERVER_PLATFORMS=("${KUBE_SERVER_PLATFORMS[@]:+"${KUBE_SERVER_PLATFORMS[@]}"}")

This comment has been minimized.

Copy link
@figo

figo May 18, 2019

Author Member

@cblecker thank you for the suggestion, your version is really nit with just one line, but i find it is less obvious and took me sometime to understand.

i would prefer to keep the current ifs if the extra line make it a little easier to understand, thanks

This comment has been minimized.

Copy link
@cblecker

cblecker May 18, 2019

Member

@figo Yours does something different, however. Yours doesn't even set KUBE_TEST_SERVER_PLATFORMS because it's an if.

Please make the requested change. Thank you!

This comment has been minimized.

Copy link
@figo

figo May 18, 2019

Author Member

@cblecker i see what you mean now, PR refreshed, thx

Check KUBE_SERVER_PLATFORMS existence
when compile kubectl on platform other than
linux/amd64, we need to check the KUBE_SERVER_PLATFORMS
array emptiness before assign it.

the example command is:
make WHAT=cmd/kubectl KUBE_BUILD_PLATFORMS="darwin/amd64 windows/amd64"

@figo figo force-pushed the figo:e2e branch from bc7b2cb to 6c8aabc May 18, 2019

@cblecker

This comment has been minimized.

Copy link
Member

commented May 18, 2019

/lgtm
/approve
/retest

@k8s-ci-robot k8s-ci-robot added the lgtm label May 18, 2019

@k8s-ci-robot

This comment has been minimized.

Copy link
Contributor

commented May 18, 2019

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cblecker, figo

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 merged commit df4b3c8 into kubernetes:master May 18, 2019

20 checks passed

cla/linuxfoundation figo authorized
Details
pull-kubernetes-bazel-build Job succeeded.
Details
pull-kubernetes-bazel-test Job succeeded.
Details
pull-kubernetes-conformance-image-test Skipped.
pull-kubernetes-cross Job succeeded.
Details
pull-kubernetes-dependencies Job succeeded.
Details
pull-kubernetes-e2e-gce Job succeeded.
Details
pull-kubernetes-e2e-gce-100-performance Job succeeded.
Details
pull-kubernetes-e2e-gce-csi-serial Skipped.
pull-kubernetes-e2e-gce-device-plugin-gpu Job succeeded.
Details
pull-kubernetes-e2e-gce-storage-slow Skipped.
pull-kubernetes-godeps Skipped.
pull-kubernetes-integration Job succeeded.
Details
pull-kubernetes-kubemark-e2e-gce-big Job succeeded.
Details
pull-kubernetes-local-e2e Skipped.
pull-kubernetes-node-e2e Job succeeded.
Details
pull-kubernetes-typecheck Job succeeded.
Details
pull-kubernetes-verify Job succeeded.
Details
pull-publishing-bot-validate Skipped.
tide In merge pool.
Details
k8s-ci-robot added a commit that referenced this pull request May 19, 2019
Merge pull request #78082 from cblecker/automated-cherry-pick-of-#77362-
#77910-#77985-#78048-#78059-upstream-release-1.14

Automated cherry pick of #77362: Don't use mapfile as it isn't bash 3 compatible #77910: fix unbound array variable #77985: fix unbound variable release.sh #78048: Don't use declare -g in build #78059: Check KUBE_SERVER_PLATFORMS existence
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.