mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-05-18 09:17:49 +08:00
bake: improve error message for empty definition
Closes #2095 Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
This commit is contained in:
parent
2f1b7a0131
commit
d0a9a81e2e
@ -159,6 +159,10 @@ func runBake(dockerCli command.Cli, targets []string, in bakeOptions, cFlags com
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(files) == 0 {
|
||||||
|
return errors.New("couldn't find a bake definition")
|
||||||
|
}
|
||||||
|
|
||||||
tgts, grps, err := bake.ReadTargets(ctx, files, targets, overrides, map[string]string{
|
tgts, grps, err := bake.ReadTargets(ctx, files, targets, overrides, map[string]string{
|
||||||
// don't forget to update documentation if you add a new
|
// don't forget to update documentation if you add a new
|
||||||
// built-in variable: docs/bake-reference.md#built-in-variables
|
// built-in variable: docs/bake-reference.md#built-in-variables
|
||||||
|
@ -29,6 +29,7 @@ var bakeTests = []func(t *testing.T, sb integration.Sandbox){
|
|||||||
testBakeRemoteCmdContextEscapeRelative,
|
testBakeRemoteCmdContextEscapeRelative,
|
||||||
testBakeRemoteDockerfileCwd,
|
testBakeRemoteDockerfileCwd,
|
||||||
testBakeRemoteLocalContextRemoteDockerfile,
|
testBakeRemoteLocalContextRemoteDockerfile,
|
||||||
|
testBakeEmpty,
|
||||||
}
|
}
|
||||||
|
|
||||||
func testBakeLocal(t *testing.T, sb integration.Sandbox) {
|
func testBakeLocal(t *testing.T, sb integration.Sandbox) {
|
||||||
@ -426,3 +427,9 @@ COPY foo /foo
|
|||||||
require.Error(t, err, out)
|
require.Error(t, err, out)
|
||||||
require.Contains(t, out, "reading a dockerfile for a remote build invocation is currently not supported")
|
require.Contains(t, out, "reading a dockerfile for a remote build invocation is currently not supported")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func testBakeEmpty(t *testing.T, sb integration.Sandbox) {
|
||||||
|
out, err := bakeCmd(sb)
|
||||||
|
require.Error(t, err, out)
|
||||||
|
require.Contains(t, out, "couldn't find a bake definition")
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user