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

Prow: Add shellcheck to openshift/installer #104

Merged
merged 2 commits into from
Aug 3, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,7 @@ jobs:
'{extends: default, rules: {line-length: {level: warning, max: 120}}}'
./examples/ ./installer/
name: YAML lint
- script: >
docker run -v $(pwd):/workdir:ro
--entrypoint sh quay.io/coreos/shellcheck-alpine:v0.5.0
-c 'for file in $(find /workdir/ -type f -name "*.sh"); do
if ! shellcheck --format=gcc $file; then export FAILED=true; fi; done;
if [ "$FAILED" != "" ]; then exit 1; fi'
- script: ./hack/shellcheck.sh
name: shellcheck
- script: "docker run -v $PWD:/go/src/github.com/openshift/installer -w /go/src/github.com/openshift/installer quay.io/coreos/golang-testing go vet ./installer/..."
name: Go vet
Expand Down
6 changes: 6 additions & 0 deletions hack/shellcheck.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh
if [ "$IS_CONTAINER" != "" ]; then
find "${1:-.}" -type f -name '*.sh' -exec shellcheck --format=gcc {} \+
else
docker run -e IS_CONTAINER='TRUE' --rm -v "$(pwd)":/workdir:ro --entrypoint sh quay.io/coreos/shellcheck-alpine:v0.5.0 /workdir/hack/shellcheck.sh /workdir;
Copy link
Member

Choose a reason for hiding this comment

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

nit: I think this should use "$(realpath "${DIR}")" instead of "$(pwd)". That way callers could point the containerized check at a specific location if they didn't want to recurse through the whole current working directory. Although with that approach you'd need to either mount this script somewhere else or copy the find command on this line to avoid the script dependency inside the container. Anyway, just ideas for future polishing; nothing to block this PR on.

fi;