-
Notifications
You must be signed in to change notification settings - Fork 2.1k
ci-operator/step-registry/gather: Fix ShellCheck quoting and useless 'cat' #9777
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
Conversation
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: wking The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Looks like I flubbed the JSONPath de-template: /hold |
…'cat'
Address [1,2]:
In .//ci-operator/step-registry/gather/aws-console/gather-aws-console-commands.sh line 35:
cat "${TMPDIR}/node-provider-IDs.txt" | sort | uniq | while read -r INSTANCE_ID
^-- SC2002: Useless cat. Consider 'cmd < file | ..' or 'cmd file | ..' instead.
For more information:
https://www.shellcheck.net/wiki/SC2002 -- Useless cat. Consider 'cmd < file...
In .//ci-operator/step-registry/gather/extra/gather-extra-commands.sh line 28:
mkdir -p ${ARTIFACT_DIR}/pods ${ARTIFACT_DIR}/nodes ${ARTIFACT_DIR}/metrics ${ARTIFACT_DIR}/bootstrap ${ARTIFACT_DIR}/network ${ARTIFACT_DIR}/oc_cmds
^-------------^ SC2086: Double quote to prevent globbing and word splitting.
^-------------^ SC2086: Double quote to prevent globbing and word splitting.
^-------------^ SC2086: Double quote to prevent globbing and word splitting.
^-------------^ SC2086: Double quote to prevent globbing and word splitting.
^-------------^ SC2086: Double quote to prevent globbing and word splitting.
^-------------^ SC2086: Double quote to prevent globbing and word splitting.
Did you mean:
mkdir -p "${ARTIFACT_DIR}"/pods "${ARTIFACT_DIR}"/nodes "${ARTIFACT_DIR}"/metrics "${ARTIFACT_DIR}"/bootstrap "${ARTIFACT_DIR}"/network "${ARTIFACT_DIR}"/oc_cmds
In .//ci-operator/step-registry/gather/extra/gather-extra-commands.sh line 31:
oc --insecure-skip-tls-verify --request-timeout=5s get pods --all-namespaces --template '{{ range .items }}{{ $name := .metadata.name }}{{ $ns := .metadata.namespace }}{{ range .spec.containers }}-n {{ $ns }} {{ $name }} -c {{ .name }}{{ "\n" }}{{ end }}{{ range .spec.initContainers }}-n {{ $ns }} {{ $name }} -c {{ .name }}{{ "\n" }}{{ end }}{{ end }}' > /tmp/containers
^-- SC2016: Expressions don't expand in single quotes, use double quotes for that.
...
For more information:
https://www.shellcheck.net/wiki/SC2016 -- Expressions don't expand in singl...
https://www.shellcheck.net/wiki/SC2086 -- Double quote to prevent globbing ...
Also:
In gather/loki/gather-loki-commands.sh line 84:
if [[ $(oc get ns -o json | jq '.items[].metadata.name' | grep '"loki"' | wc -l) -eq 0 ]]; then
^-----------^ SC2126: Consider using grep -c instead of grep|wc -l.
For more information:
https://www.shellcheck.net/wiki/SC2126 -- Consider using grep -c instead of...
The syntax for ignore directives with trailing comments is documented in [3].
I've also dropped a redundant template layer from the JSONPath
expressions where I could figure out how to do that.
[1]: https://deck-ci.apps.ci.l2s4.p1.openshiftapps.com/view/gcs/origin-ci-test/pr-logs/pull/openshift_release/9772/pull-ci-openshift-release-master-step-registry-shellcheck/1273670881133989888#1:build-log.txt%3A271
[2]: https://storage.googleapis.com/origin-ci-test/pr-logs/pull/openshift_release/9772/pull-ci-openshift-release-master-step-registry-shellcheck/1273670881133989888/build-log.txt
[3]: https://github.com/koalaman/shellcheck/wiki/Directive#documenting-directive-use
777f4fd to
1959390
Compare
|
/hold cancel Gave up on trying to figure out that particular template -> JSONPath translation, so reverted it to master's template while rebasing onto master with 777f4fdbf0 -> 1959390. |
|
@wking: The following tests failed, say
Full PR test history. Your PR dashboard. DetailsInstructions 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. |
|
@wking: The following tests failed, say
Full PR test history. Your PR dashboard. DetailsInstructions 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. |
|
@wking: The following test failed, say
Full PR test history. Your PR dashboard. DetailsInstructions 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. |
|
Issues go stale after 90d of inactivity. Mark the issue as fresh by commenting If this issue is safe to close now please do so with /lifecycle stale |
|
@wking: PR needs rebase. DetailsInstructions 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. |
|
Stale issues rot after 30d of inactivity. Mark the issue as fresh by commenting If this issue is safe to close now please do so with /lifecycle rotten |
|
Rotten issues close after 30d of inactivity. Reopen the issue by commenting /close |
|
@openshift-bot: Closed this PR. DetailsIn response to this:
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. |
Address:
The syntax for ignore directives with trailing comments is documented here.
I've also dropped a redundant template layer from the JSONPath expressions.
This helps prepare for #9772.