ci(docker): add shellcheck shell=sh directive to main-wrapper.sh - #33063
Merged
Conversation
shellcheck doesn't recognize the s6-overlay `#!/command/with-contenv sh`
shebang and aborts with SC1008 ("This shebang was unrecognized. ShellCheck
only supports sh/bash/dash/ksh/'busybox sh'. Add a 'shell' directive to
specify."). The error fires at --severity=error too, so it fails the
"Docker / shell lint" CI job on every PR that touches docker/.
Add the canonical `# shellcheck shell=sh` directive — same fix already
applied to the sibling cont-init.d scripts (`02-reconcile-profiles` and
`015-supervise-perms`) when they adopted the with-contenv shebang.
The shebang was changed from `#!/bin/sh` → `#!/command/with-contenv sh`
in PR #32412 (commit 29c71e9) to fix env-propagation through s6's PID 1.
The shellcheck-directive line was missed in that PR; this patches it.
Reproduces locally:
docker run --rm -v "$PWD:/mnt" -w /mnt koalaman/shellcheck:stable \
--severity=error --format=gcc docker/main-wrapper.sh
Before: docker/main-wrapper.sh:1:1: error: [SC1008] (rc=1)
After: (no output) (rc=0)
Script behavior is unchanged — the directive is a comment, and `sh -n`
/ `bash -n` parse the file cleanly either way.
Contributor
🔎 Lint report:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The
Docker / shell lintCI job currently fails on every PR that touchesdocker/. The actual error:shellcheck doesn't recognize the s6-overlay
#!/command/with-contenv shshebang and treats it as a hard error (the workflow runs with--severity=errorbut SC1008 fires at that severity anyway).How we got here
PR #32412 (commit
29c71e9) correctly changed the shebang from#!/bin/sh→#!/command/with-contenv shto fix env-propagation through s6-overlay's/initPID 1. That change is right.The
# shellcheck shell=shdirective — already present on the siblingdocker/cont-init.d/02-reconcile-profilesand015-supervise-permsscripts which use the same shebang — was missed whenmain-wrapper.shadopted it.Fix
Add
# shellcheck shell=shas the second line ofdocker/main-wrapper.sh. Same pattern as the working sibling scripts.The directive is a comment; script behavior is unchanged.
Validation
Local reproduction of the CI failure (using
koalaman/shellcheck:stable, the same imageludeeus/action-shellcheckshells out to):docker run --rm -v "$PWD:/mnt" -w /mnt koalaman/shellcheck:stable \ --severity=error --format=gcc docker/main-wrapper.shdocker/main-wrapper.sh:1:1: error: [SC1008](rc=1)Parser sanity-check (
sh -n/bash -n) passes on both before and after — the directive doesn't change script semantics.After this lands
The Docker / shell lint job goes green for every PR touching
docker/. Currently visible failures on at least #33060 will clear on rebase.