From 048ef1fbf872123ec3306467e63b56e14b8bb11b Mon Sep 17 00:00:00 2001 From: David Karlsson <35727626+dvdksn@users.noreply.github.com> Date: Wed, 3 Jul 2024 09:51:28 +0200 Subject: [PATCH 1/2] fix: buildx b alias the shorthand "b" alias was accidentally removed in 19d838a Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com> --- commands/build.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/commands/build.go b/commands/build.go index 374f4d54f623..1bf77dc81263 100644 --- a/commands/build.go +++ b/commands/build.go @@ -528,9 +528,10 @@ func buildCmd(dockerCli command.Cli, rootOpts *rootOptions, debugConfig *debug.D options := &buildOptions{} cmd := &cobra.Command{ - Use: "build [OPTIONS] PATH | URL | -", - Short: "Start a build", - Args: cli.ExactArgs(1), + Use: "build [OPTIONS] PATH | URL | -", + Short: "Start a build", + Args: cli.ExactArgs(1), + Aliases: []string{"b"}, Annotations: map[string]string{ "aliases": "docker build, docker builder build, docker image build, docker buildx b", }, From 2e7e7abe429657a283e5b3951c22711de3079d0a Mon Sep 17 00:00:00 2001 From: David Karlsson <35727626+dvdksn@users.noreply.github.com> Date: Wed, 3 Jul 2024 10:04:09 +0200 Subject: [PATCH 2/2] test: add test for building with alias "buildx b" Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com> --- tests/build.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/build.go b/tests/build.go index 2b48bdc7ad32..dfb99a7f4164 100644 --- a/tests/build.go +++ b/tests/build.go @@ -43,6 +43,7 @@ func buildCmd(sb integration.Sandbox, opts ...cmdOpt) (string, error) { var buildTests = []func(t *testing.T, sb integration.Sandbox){ testBuild, + testBuildAlias, testBuildStdin, testBuildRemote, testBuildLocalState, @@ -81,6 +82,13 @@ func testBuild(t *testing.T, sb integration.Sandbox) { require.NoError(t, err, string(out)) } +func testBuildAlias(t *testing.T, sb integration.Sandbox) { + dir := createTestProject(t) + cmd := buildxCmd(sb, withDir(dir), withArgs("b", dir)) + out, err := cmd.CombinedOutput() + require.NoError(t, err, string(out)) +} + func testBuildStdin(t *testing.T, sb integration.Sandbox) { dockerfile := []byte(` FROM busybox:latest AS base