fix: support SHELL during RUN commands in image build#6695
Open
aeijdenberg wants to merge 1 commit intocontainers:mainfrom
Open
fix: support SHELL during RUN commands in image build#6695aeijdenberg wants to merge 1 commit intocontainers:mainfrom
aeijdenberg wants to merge 1 commit intocontainers:mainfrom
Conversation
Currently adding a SHELL instruction results in a WARN message, but then continues to build the image, using the incorrect shell (the default shell) if the output format is to OCI. While the OCI spec doesn't allow persistence of the SHELL value, it also doesn't actually define the format of a Dockerfile/Containerfile, and the primary examples given in Docker documentation for use of SHELL is to affect subsequent RUN commands, which is a build time operation. Since this is a build time operation, the final output format shouldn't cause a change in behaviour. This removes the conditional that disables it, and adjusts the WARN message. Signed-off-by: Adam Eijdenberg <adam@continusec.com>
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.
Currently adding a SHELL instruction results in a WARN message, but then continues to build the image, using the incorrect shell (the default shell) if the output format is to OCI.
While the OCI spec doesn't allow persistence of the SHELL value, it also doesn't actually define the format of a Dockerfile/Containerfile, and the primary examples given in Docker documentation for use of SHELL is to affect subsequent RUN commands, which is a build time operation.
Since this is a build time operation, the final output format shouldn't cause a change in behaviour.
This removes the conditional that disables it, and adjusts the WARN message.
What type of PR is this?
I think it fixes a bug - because previously it would emit a
WARNbut then not actually fail, but instead use the wrong shell.What this PR does / why we need it:
Better compatiblity with Dockerfiles.
How to verify it
See test in tests/bud.bats
Which issue(s) this PR fixes:
Fixes #6460.
Special notes for your reviewer:
Docker docs:
https://docs.docker.com/reference/dockerfile/#shell
There's some interesting and relevant discussion in:
opencontainers/image-spec#1248 (comment)
Does this PR introduce a user-facing change?