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

fix shellcheck in test-smoke.sh and test-network.sh #75573

Merged
merged 1 commit into from
Apr 20, 2019

Conversation

xichengliudui
Copy link
Contributor

What type of PR is this?

/kind cleanup

What this PR does / why we need it:
fixshellcheck190321

Which issue(s) this PR fixes:

Ref #72956

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

NONE

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Mar 22, 2019
@k8s-ci-robot k8s-ci-robot added sig/cluster-lifecycle Categorizes an issue or PR as relevant to SIG Cluster Lifecycle. and removed needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Mar 22, 2019
KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
# export KUBE_CONFIG_FILE
# use kubeconfig default file
export KUBE_CONFIG_FILE="config-default.sh"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why did I do that:

In ./cluster/test-network.sh line 28:
KUBE_CONFIG_FILE="config-default.sh"
^--------------^ SC2034: KUBE_CONFIG_FILE appears unused. Verify use (or export if used externally).

Copy link
Member

Choose a reason for hiding this comment

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

I'm really wary of this one, what's using this downstream, ginkgo-e2e or something?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If we do not select export, we can only delete.
https://github.com/koalaman/shellcheck/wiki/SC2034

Copy link
Contributor

Choose a reason for hiding this comment

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

currently, ginkgo-e2e.sh seems to use KUBE_CONFIG_FILE="config-test.sh".
If it is exported in test-network.sh, ginkgo-e2e.sh uses config-default.sh instead of config-test.sh.
I think deleting is better for keeping current behavior...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@spiffxp what do you think?

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, to maintain current behaviour, we should just remove KUBE_CONFIG_FILE from cluster/test-network.sh

Copy link
Member

Choose a reason for hiding this comment

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

Agree, let's delete please


TEST_ARGS="$@"
TEST_ARGS=("$@")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why did I do that:

In ./cluster/test-smoke.sh line 28:
TEST_ARGS="$@"
          ^--^ SC2124: Assigning an array to a string! Assign as array, or use * instead of @ to concatenate.

Copy link
Member

Choose a reason for hiding this comment

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

doing this only to expand as TEST_ARGS[0] down below seems like needless indirection, I feel like there's got to be a better way to express this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There should be no problem with this modification.
Ref: https://github.com/koalaman/shellcheck/wiki/SC2124

Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
TEST_ARGS=("$@")
TEST_ARGS="$*"

Wouldn't that work just as easy?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Has been updated.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry, I shouldn't have revised it all based on the shellcheck example.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

/cc cblecker

@xichengliudui
Copy link
Contributor Author

/assign @spiffxp @BenTheElder

Copy link
Member

@spiffxp spiffxp left a comment

Choose a reason for hiding this comment

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

this is not a clear LGTM to me yet

KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
# export KUBE_CONFIG_FILE
# use kubeconfig default file
export KUBE_CONFIG_FILE="config-default.sh"
Copy link
Member

Choose a reason for hiding this comment

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

I'm really wary of this one, what's using this downstream, ginkgo-e2e or something?


TEST_ARGS="$@"
TEST_ARGS=("$@")
Copy link
Member

Choose a reason for hiding this comment

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

doing this only to expand as TEST_ARGS[0] down below seems like needless indirection, I feel like there's got to be a better way to express this?

@xichengliudui
Copy link
Contributor Author

/retest

@xichengliudui
Copy link
Contributor Author

/cc @cblecker @BenTheElder

KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
# export KUBE_CONFIG_FILE
# use kubeconfig default file
export KUBE_CONFIG_FILE="config-default.sh"
Copy link
Member

Choose a reason for hiding this comment

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

Yeah, to maintain current behaviour, we should just remove KUBE_CONFIG_FILE from cluster/test-network.sh


TEST_ARGS="$@"
TEST_ARGS="$*"
Copy link
Member

Choose a reason for hiding this comment

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

Actually, had another look at this.. there's no need to pass this through another variable. We can scrap this line completely, and where TEST_ARGS is referenced below, we can just use "$@"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I have updated it

update pull request

update pull request

update pull request

update pull request
@k8s-ci-robot k8s-ci-robot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Apr 20, 2019
@@ -25,8 +25,8 @@ set -o pipefail

KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/..

TEST_ARGS="$@"
TEST_ARGS=( "$@" )
Copy link
Contributor Author

Choose a reason for hiding this comment

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

pr has been updated.
You can refer to: https://github.com/koalaman/shellcheck/wiki/SC2124

@xichengliudui
Copy link
Contributor Author

/cc @spiffxp @BenTheElder

@xichengliudui
Copy link
Contributor Author

/priority backlog

@k8s-ci-robot k8s-ci-robot added priority/backlog Higher priority than priority/awaiting-more-evidence. and removed needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Apr 20, 2019
@xichengliudui
Copy link
Contributor Author

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

@xichengliudui
Copy link
Contributor Author

/cc @cblecker

@spiffxp
Copy link
Member

spiffxp commented Apr 20, 2019

/approve
/lgtm

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

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: spiffxp, xichengliudui

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 Apr 20, 2019
@k8s-ci-robot k8s-ci-robot merged commit 95b5b98 into kubernetes:master Apr 20, 2019
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/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm "Looks good to me", indicates that a PR is ready to be merged. priority/backlog Higher priority than priority/awaiting-more-evidence. release-note-none Denotes a PR that doesn't merit a release note. sig/cluster-lifecycle Categorizes an issue or PR as relevant to SIG Cluster Lifecycle. 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.

None yet

6 participants