-
Notifications
You must be signed in to change notification settings - Fork 600
build: display Dockerfile path on check warnings #2672
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -35,7 +35,7 @@ import ( | |
| "github.com/tonistiigi/fsutil" | ||
| ) | ||
|
|
||
| func toSolveOpt(ctx context.Context, node builder.Node, multiDriver bool, opt Options, bopts gateway.BuildOpts, configDir string, pw progress.Writer, docker *dockerutil.Client) (_ *client.SolveOpt, release func(), err error) { | ||
| func toSolveOpt(ctx context.Context, node builder.Node, multiDriver bool, opt *Options, bopts gateway.BuildOpts, configDir string, pw progress.Writer, docker *dockerutil.Client) (_ *client.SolveOpt, release func(), err error) { | ||
| nodeDriver := node.Driver | ||
| defers := make([]func(), 0, 2) | ||
| releaseF := func() { | ||
|
|
@@ -263,7 +263,7 @@ func toSolveOpt(ctx context.Context, node builder.Node, multiDriver bool, opt Op | |
| so.Exports = opt.Exports | ||
| so.Session = slices.Clone(opt.Session) | ||
|
|
||
| releaseLoad, err := loadInputs(ctx, nodeDriver, opt.Inputs, pw, &so) | ||
| releaseLoad, err := loadInputs(ctx, nodeDriver, &opt.Inputs, pw, &so) | ||
| if err != nil { | ||
| return nil, nil, err | ||
| } | ||
|
|
@@ -356,19 +356,20 @@ func toSolveOpt(ctx context.Context, node builder.Node, multiDriver bool, opt Op | |
| return &so, releaseF, nil | ||
| } | ||
|
|
||
| func loadInputs(ctx context.Context, d *driver.DriverHandle, inp Inputs, pw progress.Writer, target *client.SolveOpt) (func(), error) { | ||
| func loadInputs(ctx context.Context, d *driver.DriverHandle, inp *Inputs, pw progress.Writer, target *client.SolveOpt) (func(), error) { | ||
| if inp.ContextPath == "" { | ||
| return nil, errors.New("please specify build context (e.g. \".\" for the current directory)") | ||
| } | ||
|
|
||
| // TODO: handle stdin, symlinks, remote contexts, check files exist | ||
|
|
||
| var ( | ||
| err error | ||
| dockerfileReader io.ReadCloser | ||
| dockerfileDir string | ||
| dockerfileName = inp.DockerfilePath | ||
| toRemove []string | ||
| err error | ||
| dockerfileReader io.ReadCloser | ||
| dockerfileDir string | ||
| dockerfileName = inp.DockerfilePath | ||
| dockerfileSrcName = inp.DockerfilePath | ||
| toRemove []string | ||
| ) | ||
|
|
||
| switch { | ||
|
|
@@ -440,6 +441,11 @@ func loadInputs(ctx context.Context, d *driver.DriverHandle, inp Inputs, pw prog | |
|
|
||
| if inp.DockerfileInline != "" { | ||
| dockerfileReader = io.NopCloser(strings.NewReader(inp.DockerfileInline)) | ||
| dockerfileSrcName = "inline" | ||
| } else if inp.DockerfilePath == "-" { | ||
| dockerfileSrcName = "stdin" | ||
|
Comment on lines
+444
to
+446
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What will be the output for Something like this would be confusing: If someone has a Dockerfile named
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Removing the line entirely requires either a I was trying to model what @tonistiigi had suggested, here. For MY part, I think that ambiguity around two very specifically named Dockerfiles (in this case,
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Yes that sounds good, let's check that for a follow-up then |
||
| } else if inp.DockerfilePath == "" { | ||
| dockerfileSrcName = filepath.Join(inp.ContextPath, "Dockerfile") | ||
| } | ||
|
|
||
| if dockerfileReader != nil { | ||
|
|
@@ -540,6 +546,9 @@ func loadInputs(ctx context.Context, d *driver.DriverHandle, inp Inputs, pw prog | |
| _ = os.RemoveAll(dir) | ||
| } | ||
| } | ||
|
|
||
| inp.DockerfileMappingSrc = dockerfileSrcName | ||
| inp.DockerfileMappingDst = dockerfileName | ||
| return release, nil | ||
| } | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.