Skip to content

Commit 7b80ad7

Browse files
authored
Merge pull request #2569 from dvdksn/fix-alias
fix: buildx b alias
2 parents c0c4d71 + 2e7e7ab commit 7b80ad7

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

commands/build.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -528,9 +528,10 @@ func buildCmd(dockerCli command.Cli, rootOpts *rootOptions, debugConfig *debug.D
528528
options := &buildOptions{}
529529

530530
cmd := &cobra.Command{
531-
Use: "build [OPTIONS] PATH | URL | -",
532-
Short: "Start a build",
533-
Args: cli.ExactArgs(1),
531+
Use: "build [OPTIONS] PATH | URL | -",
532+
Short: "Start a build",
533+
Args: cli.ExactArgs(1),
534+
Aliases: []string{"b"},
534535
Annotations: map[string]string{
535536
"aliases": "docker build, docker builder build, docker image build, docker buildx b",
536537
},

tests/build.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ func buildCmd(sb integration.Sandbox, opts ...cmdOpt) (string, error) {
4343

4444
var buildTests = []func(t *testing.T, sb integration.Sandbox){
4545
testBuild,
46+
testBuildAlias,
4647
testBuildStdin,
4748
testBuildRemote,
4849
testBuildLocalState,
@@ -81,6 +82,13 @@ func testBuild(t *testing.T, sb integration.Sandbox) {
8182
require.NoError(t, err, string(out))
8283
}
8384

85+
func testBuildAlias(t *testing.T, sb integration.Sandbox) {
86+
dir := createTestProject(t)
87+
cmd := buildxCmd(sb, withDir(dir), withArgs("b", dir))
88+
out, err := cmd.CombinedOutput()
89+
require.NoError(t, err, string(out))
90+
}
91+
8492
func testBuildStdin(t *testing.T, sb integration.Sandbox) {
8593
dockerfile := []byte(`
8694
FROM busybox:latest AS base

0 commit comments

Comments
 (0)