Merge pull request #2569 from dvdksn/fix-alias

fix: buildx b alias
This commit is contained in:
CrazyMax 2024-07-03 10:14:45 +02:00 committed by GitHub
commit 7b80ad7069
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 3 deletions

View File

@ -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",
},

View File

@ -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