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: add suggestions to how to fix certain errors #2218

Merged
merged 5 commits into from
Jul 7, 2021

Conversation

tonistiigi
Copy link
Member

Detects mistyped:

  • instructions
  • stage names
  • flags
  • mount keys
  • mount types

@@ -243,7 +252,7 @@ func Dockerfile2LLB(ctx context.Context, dt []byte, opt ConvertOpt) (*llb.State,
}
d.stage.BaseName = reference.TagNameOnly(ref).String()
var isScratch bool
if metaResolver != nil && reachable && !d.unregistered {
if metaResolver != nil && reachable {
Copy link
Member Author

Choose a reason for hiding this comment

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

Copy from image will now load image config here although it is not needed to get an error in the correct place. The config would have been still downloaded together with the image layers before.

@@ -23,7 +22,7 @@ func splitCommand(line string) (string, []string, string, error) {
}
}

return cmd, flags, strings.TrimSpace(args), nil
return cmdline[0], flags, strings.TrimSpace(args), nil
Copy link
Member Author

Choose a reason for hiding this comment

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

Previously parser changed the casing of what the user had typed. This keeps it so that correct values can be shown on errors and should normalize to lowercase where it is actually needed.


func commonImageNames() []string {
repos := []string{
"alpine", "busybox", "centos", "debian", "golang", "ubuntu", "fedora",
Copy link
Member

Choose a reason for hiding this comment

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

CentOS is about to die soon :)

Copy link
Member

Choose a reason for hiding this comment

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

(I noticed this is used only for typo-checking, so it's fine to retain centos here)

@tonistiigi tonistiigi force-pushed the error-suggest branch 2 times, most recently from 02c1e72 to 49524c6 Compare July 3, 2021 00:26
@tonistiigi tonistiigi requested review from AkihiroSuda and coryb July 6, 2021 22:22
@tonistiigi tonistiigi added this to the v0.9.0 milestone Jul 7, 2021
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 stuff :)

Copy link
Collaborator

@coryb coryb left a comment

Choose a reason for hiding this comment

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

nice, lgtm

@tonistiigi tonistiigi merged commit 9df5993 into moby:master Jul 7, 2021
@crazy-max crazy-max mentioned this pull request Aug 18, 2021
ingvagabund added a commit to ingvagabund/oc that referenced this pull request Jul 3, 2024
The lowercasing of the command value was undone
to allow to print an error message with the original casing.

moby/buildkit#2218 (comment)
for more context.
ingvagabund added a commit to ingvagabund/oc that referenced this pull request Jul 3, 2024
The lowercasing of the command value was undone
to allow to print an error message with the original casing.

moby/buildkit#2218 (comment)
for more context.
ingvagabund added a commit to ingvagabund/oc that referenced this pull request Jul 4, 2024
The lowercasing of the command value was undone
to allow to print an error message with the original casing.

moby/buildkit#2218 (comment)
for more context.
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.

4 participants