Test-infra: figure out shellcheck in CI (and locally)

Created on 19 May 2018  Â·  12Comments  Â·  Source: kubernetes/test-infra

https://github.com/koalaman/shellcheck seems to be a pretty awesome tool for linting shellscripts.

we can probably use WORKSPACE dependencies on shellcheck binaries, but the linux builds seem to have a dodgy glibc linkage and there don't seem to be published macOS binaries. we could build ourselves and stick them in GCS or something, but until then we're just making a lot of fixes from @rmmh running it locally.

/kind enhancement
xref: https://github.com/kubernetes/test-infra/pull/8032

kinfeature prioritimportant-longterm

Most helpful comment

I think I looked at enabling shellcheck on kubernetes/kubernetes at one point, but there were so many errors reported I gave up and ran away screaming.

All 12 comments

/cc @ixdy @rmmh
/assign
No idea when I'll do this (now? someday?) but if you both don't get to it first I'd like to see this figured out, we have too much shell to not be linting it :-)

I think I looked at enabling shellcheck on kubernetes/kubernetes at one point, but there were so many errors reported I gave up and ran away screaming.

I had the same idea/experience as @ixdy :)
cc @stevekuznetsov

I think I looked at enabling shellcheck on kubernetes/kubernetes at one point, but there were so many errors reported I gave up and ran away screaming.

we could do what test-infra does with lints, which is to incrementally widen the set of sources that are actually linted, excluding directories nobody has had time to fix yet.

Future thought: for linting jobs (golint, shellcheck, even misspell) if we could use the github Checks API. I think they'd all be good candidates for portable jobs, and then we can run them anywhere. A much bigger thing to bite off, but perhaps an interesting project.

Yeah. We have a golint plugin with sort of a home rolled variant of the
checks now. I think we don't have access to the checks API currently (in
beta, and only for GitHub Apps)

On Fri, May 18, 2018, 6:16 PM Christoph Blecker notifications@github.com
wrote:

Future thought: for linting jobs (golint, shellcheck, even misspell) if we
could use the github Checks API. I think they'd all be good candidates for
portable jobs, and then we can run them anywhere. A much bigger thing to
bite off, but perhaps an interesting project.

—
You are receiving this because you were assigned.
Reply to this email directly, view it on GitHub
https://github.com/kubernetes/test-infra/issues/8090#issuecomment-390367993,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AA4BqwAhtxLDukRLWOB02ryPUCjclY8Fks5tz3JzgaJpZM4UFf9X
.

we're at least working on fixing shellcheck lints throughout test-infra, getting it in CI is a next step.

for file in $(find . -type f -name "*.sh"); do shellcheck --format=gcc $file >> outs ; done;

shellchecktestinfra.txt
I added a little line between the vendor stuff and what's in test-infra
stuff in test-infra comes up to 234 lines so 234 fixes
if there needs to be an extra push in cleaning this up I would be interested in helping out.

It's not so much fixing the shellcheck errors we currently have that is an issue, it's getting it working in CI and locally on mac / linux with minimal effort from contributors. I'm looking into this.

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle rotten

I added this in k/k now
/remove-lifecycle rotten

Was this page helpful?
0 / 5 - 0 ratings