Skip to content

Commit

Permalink
remove flag validation
Browse files Browse the repository at this point in the history
Signed-off-by: Matej Vasek <[email protected]>
  • Loading branch information
matejvasek committed Feb 16, 2021
1 parent c9f1805 commit 3dc4335
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 21 deletions.
10 changes: 0 additions & 10 deletions internal/commands/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,16 +174,6 @@ func validateBuildFlags(flags *BuildFlags, cfg config.Config, packClient PackCli
return errors.New("cache-image flag requires the publish flag")
}

dockerHostValid := strings.HasPrefix(flags.DockerHost, `tcp://`) ||
strings.HasPrefix(flags.DockerHost, `unix://`) ||
strings.HasPrefix(flags.DockerHost, `npipe://`) ||
strings.HasPrefix(flags.DockerHost, `npipe:\\`) ||
flags.DockerHost == "inherit" ||
flags.DockerHost == ""
if !dockerHostValid {
return errors.New("value of docker-host flag is not valid")
}

return nil
}

Expand Down
12 changes: 1 addition & 11 deletions internal/commands/build_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,17 +75,7 @@ func testBuildCommand(t *testing.T, when spec.G, it spec.S) {
command.SetArgs([]string{"--builder", "my-builder", "image"})
h.AssertNil(t, command.Execute())
})

it("docker-host value is invalid", func() {
mockClient.EXPECT().
Build(gomock.Any(), EqBuildOptionsWithImage("my-builder", "image")).
Return(nil)

command.SetArgs([]string{"--builder", "my-builder", "image", "--docker-host", "@bad_val"})
err := command.Execute()
h.AssertError(t, err, "value of docker-host flag is not valid")
})


it("builds an image with a builder short command arg", func() {
mockClient.EXPECT().
Build(gomock.Any(), EqBuildOptionsWithImage("my-builder", "image")).
Expand Down

0 comments on commit 3dc4335

Please sign in to comment.