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: ensure config resolve errors keep source location #2183

Merged
merged 1 commit into from
Jun 17, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 9 additions & 4 deletions frontend/dockerfile/dockerfile2llb/convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,10 +227,15 @@ func Dockerfile2LLB(ctx context.Context, dt []byte, opt ConvertOpt) (*llb.State,
continue
}
func(i int, d *dispatchState) {
eg.Go(func() error {
eg.Go(func() (err error) {
defer func() {
if err != nil {
err = parser.WithLocation(err, d.stage.Location)
}
}()
ref, err := reference.ParseNormalizedNamed(d.stage.BaseName)
if err != nil {
return parser.WithLocation(errors.Wrapf(err, "failed to parse stage name %q", d.stage.BaseName), d.stage.Location)
return errors.Wrapf(err, "failed to parse stage name %q", d.stage.BaseName)
}
platform := d.platform
if platform == nil {
Expand All @@ -250,11 +255,11 @@ func Dockerfile2LLB(ctx context.Context, dt []byte, opt ConvertOpt) (*llb.State,
LogName: fmt.Sprintf("%s load metadata for %s", prefix, d.stage.BaseName),
})
if err != nil {
return err
return errors.Wrap(err, d.stage.BaseName)
}
var img Image
if err := json.Unmarshal(dt, &img); err != nil {
return err
return errors.Wrap(err, "failed to parse image config")
}
img.Created = nil
// if there is no explicit target platform, try to match based on image config
Expand Down