Skip to content
This repository has been archived by the owner on Jun 13, 2021. It is now read-only.

Commit

Permalink
Merge pull request #625 from aiordache/app-214_experimental_validate
Browse files Browse the repository at this point in the history
[WIP] APP-214 Enable 'docker app validate' for experimental mode only
  • Loading branch information
rumpl authored Nov 12, 2019
2 parents 4e0989c + ed930a8 commit aeb12c0
Show file tree
Hide file tree
Showing 30 changed files with 121 additions and 94 deletions.
8 changes: 4 additions & 4 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ required = ["github.com/wadey/gocovmerge"]

[[override]]
name = "github.com/docker/cli"
revision = "6318939f30e01585b34eb6a68a54b890a8d54eb0"
revision = "37f9a88c696ae81be14c1697bd083d6421b4933c"

[[override]]
name = "github.com/deislabs/cnab-go"
Expand All @@ -71,7 +71,7 @@ required = ["github.com/wadey/gocovmerge"]
[[override]]
name = "github.com/xeipuuv/gojsonschema"
version = "v1.2.0"

[[override]]
name = "github.com/docker/go-metrics"
revision = "d466d4f6fd960e01820085bd7e1a24426ee7ef18"
Expand Down Expand Up @@ -117,6 +117,7 @@ required = ["github.com/wadey/gocovmerge"]
name = "github.com/Microsoft/hcsshim"
revision = "2226e083fc390003ae5aa8325c3c92789afa0e7a"


[[constraint]]
name = "github.com/spf13/pflag"
branch = "master"
Expand Down
16 changes: 14 additions & 2 deletions internal/commands/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func NewRootCmd(use string, dockerCli command.Cli) *cobra.Command {
}

func addCommands(cmd *cobra.Command, dockerCli command.Cli) {
cmd.AddCommand(
listOfCommands := []*cobra.Command{
runCmd(dockerCli),
updateCmd(dockerCli),
removeCmd(dockerCli),
Expand All @@ -60,7 +60,19 @@ func addCommands(cmd *cobra.Command, dockerCli command.Cli) {
image.Cmd(dockerCli),
build.Cmd(dockerCli),
inspectCmd(dockerCli),
)
}

isExperimentalMode := dockerCli.ClientInfo().HasExperimental
for _, ccmd := range listOfCommands {
switch ccmd.Annotations["experimental"] {
case "true":
if isExperimentalMode {
cmd.AddCommand(ccmd)
}
default:
cmd.AddCommand(ccmd)
}
}
}

func firstOrEmpty(list []string) string {
Expand Down
9 changes: 5 additions & 4 deletions internal/commands/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@ type validateOptions struct {
func validateCmd() *cobra.Command {
var opts validateOptions
cmd := &cobra.Command{
Use: "validate [OPTIONS] APP_DEFINITION",
Short: "Check that an App definition (.dockerapp) is syntactically correct",
Example: `$ docker app validate myapp.dockerapp --set key=value --parameters-file myparam.yml`,
Args: cli.RequiresMaxArgs(1),
Use: "validate [OPTIONS] APP_DEFINITION",
Short: "Check that an App definition (.dockerapp) is syntactically correct",
Example: `$ docker app validate myapp.dockerapp --set key=value --parameters-file myparam.yml`,
Args: cli.RequiresMaxArgs(1),
Annotations: map[string]string{"experimental": "true"},
RunE: func(cmd *cobra.Command, args []string) error {
return runValidate(args, opts)
},
Expand Down
56 changes: 41 additions & 15 deletions vendor/github.com/docker/cli/cli/command/cli.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 7 additions & 2 deletions vendor/github.com/docker/cli/cli/command/formatter/image.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vendor/github.com/docker/cli/cli/command/utils.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions vendor/github.com/docker/cli/cli/compose/convert/compose.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 7 additions & 14 deletions vendor/github.com/docker/cli/cli/compose/convert/service.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit aeb12c0

Please sign in to comment.