Skip to content

shellcheck: add yaml helper script#2743

Draft
deer-wmde wants to merge 7 commits into
mainfrom
de/shellcheck-yaml
Draft

shellcheck: add yaml helper script#2743
deer-wmde wants to merge 7 commits into
mainfrom
de/shellcheck-yaml

Conversation

@deer-wmde
Copy link
Copy Markdown
Contributor

@deer-wmde deer-wmde commented May 8, 2026

Since shellcheck does not parse the embedded shell scripts we have in our k8s job yaml files, I tried to see if they can be reliably extracted via yq, in order to lint them. This PR contains a script that extracts them in a git-ignored directory. I tried running this in CI on this repo fork here: https://github.com/deer-wmde/debug-wbaas-deploy/actions/runs/25557616246/job/75020526364 (sadly the output in this example run is bloated by all the other recommendations for "real" scripts, too)

weak points:

  • the script assumes the currently used pattern of using shell -c command
  • there might be more embedded shell scripts somewhere else in the repo, outside of /k8s/jobs/ (now or in the future)

Still I think this could be handy to have, as errors in these scripts are especially tricky.

https://phabricator.wikimedia.org/T302394

Bug: T302394

@deer-wmde
Copy link
Copy Markdown
Contributor Author

deer-wmde commented May 15, 2026

Today I tried if this would work with shfmt too - it does in theory, but in practice would make them even more unreadable while looking at the YAML

This means currently the CI workflow #2740 would kinda need a messy order to run:

  • shellcheck & shfmt
  • then this script
  • shellcheck again

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant