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
Merged

Conversation

figo
Copy link
Contributor

@figo figo 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

@k8s-ci-robot k8s-ci-robot added kind/bug Categorizes issue or PR as related to a bug. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. sig/release Categorizes an issue or PR as relevant to SIG Release. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels May 18, 2019
@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels May 18, 2019
@figo
Copy link
Contributor Author

figo 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
Copy link

@jiatongw jiatongw left a comment

Choose a reason for hiding this comment

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

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
Copy link
Contributor Author

figo commented May 18, 2019

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

@dims
Copy link
Member

dims commented May 18, 2019

/assign @cblecker @BenTheElder

@tpepper
Copy link
Member

tpepper 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[@]}")
Copy link
Member

Choose a reason for hiding this comment

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

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[@]}"}")

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@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

Copy link
Member

Choose a reason for hiding this comment

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

@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!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

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

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"
@cblecker
Copy link
Member

/lgtm
/approve
/retest

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

[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 added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 18, 2019
@k8s-ci-robot k8s-ci-robot merged commit df4b3c8 into kubernetes:master May 18, 2019
k8s-ci-robot added a commit that referenced this pull request May 19, 2019
#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
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/release Categorizes an issue or PR as relevant to SIG Release. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make release of v1.14.2 failed
7 participants