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

dockerfile: improve error messages and add suggest to flag parsing #4925

Merged
merged 3 commits into from
May 30, 2024

Conversation

tonistiigi
Copy link
Member

@tonistiigi tonistiigi commented May 14, 2024

Improve the error messages for error messages if FROM flags if they are caused by mismatched variables.

Additional commits improve the messages for UndeclaredArgInFrom and UndefinedVar warnings.

Example:

Dockerfile:1
--------------------
   1 | >>> FROM --platform=$BULIDPLATFORM alpine
   2 |     RUN apk add git
   3 |
--------------------
ERROR: failed to solve: failed to parse platform : "" is an invalid component of "": platform specifier component must match "^[A-Za-z0-9_-]+$": invalid argument
Dockerfile:1
--------------------
   1 | >>> FROM --platform=$BULIDPLATFORM alpine
   2 |     RUN apk add git
   3 |     
--------------------
ERROR: failed to solve: empty platform value from expression $BULIDPLATFORM (did you mean BUILDPLATFORM?)

@tonistiigi tonistiigi changed the title dockerfile: improve error messages and add suggest to platform flag p… dockerfile: improve error messages and add suggest to flag parsing May 14, 2024
…arsing

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
@tonistiigi tonistiigi force-pushed the dockerfile-platform-validation branch from 1c57c6e to 1f3fce4 Compare May 14, 2024 06:17
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
@tonistiigi tonistiigi force-pushed the dockerfile-platform-validation branch from 1f3fce4 to 94ee93a Compare May 14, 2024 06:41
@tonistiigi tonistiigi requested a review from daghack May 14, 2024 07:05
@tonistiigi tonistiigi marked this pull request as ready for review May 14, 2024 07:05
@tonistiigi tonistiigi added this to the v0.14.0 milestone May 28, 2024
Copy link
Member

@crazy-max crazy-max left a comment

Choose a reason for hiding this comment

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

Nice will be much easier to grasp for people!

@tonistiigi tonistiigi merged commit 1eb2a03 into moby:master May 30, 2024
73 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants