Skip to content
This repository was archived by the owner on Jul 18, 2025. It is now read-only.

Commit aeb12c0

Browse files
authored
Merge pull request #625 from aiordache/app-214_experimental_validate
[WIP] APP-214 Enable 'docker app validate' for experimental mode only
2 parents 4e0989c + ed930a8 commit aeb12c0

File tree

30 files changed

+121
-94
lines changed

30 files changed

+121
-94
lines changed

Gopkg.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Gopkg.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ required = ["github.com/wadey/gocovmerge"]
5050

5151
[[override]]
5252
name = "github.com/docker/cli"
53-
revision = "6318939f30e01585b34eb6a68a54b890a8d54eb0"
53+
revision = "37f9a88c696ae81be14c1697bd083d6421b4933c"
5454

5555
[[override]]
5656
name = "github.com/deislabs/cnab-go"
@@ -71,7 +71,7 @@ required = ["github.com/wadey/gocovmerge"]
7171
[[override]]
7272
name = "github.com/xeipuuv/gojsonschema"
7373
version = "v1.2.0"
74-
74+
7575
[[override]]
7676
name = "github.com/docker/go-metrics"
7777
revision = "d466d4f6fd960e01820085bd7e1a24426ee7ef18"
@@ -117,6 +117,7 @@ required = ["github.com/wadey/gocovmerge"]
117117
name = "github.com/Microsoft/hcsshim"
118118
revision = "2226e083fc390003ae5aa8325c3c92789afa0e7a"
119119

120+
120121
[[constraint]]
121122
name = "github.com/spf13/pflag"
122123
branch = "master"

internal/commands/root.go

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ func NewRootCmd(use string, dockerCli command.Cli) *cobra.Command {
4848
}
4949

5050
func addCommands(cmd *cobra.Command, dockerCli command.Cli) {
51-
cmd.AddCommand(
51+
listOfCommands := []*cobra.Command{
5252
runCmd(dockerCli),
5353
updateCmd(dockerCli),
5454
removeCmd(dockerCli),
@@ -60,7 +60,19 @@ func addCommands(cmd *cobra.Command, dockerCli command.Cli) {
6060
image.Cmd(dockerCli),
6161
build.Cmd(dockerCli),
6262
inspectCmd(dockerCli),
63-
)
63+
}
64+
65+
isExperimentalMode := dockerCli.ClientInfo().HasExperimental
66+
for _, ccmd := range listOfCommands {
67+
switch ccmd.Annotations["experimental"] {
68+
case "true":
69+
if isExperimentalMode {
70+
cmd.AddCommand(ccmd)
71+
}
72+
default:
73+
cmd.AddCommand(ccmd)
74+
}
75+
}
6476
}
6577

6678
func firstOrEmpty(list []string) string {

internal/commands/validate.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,11 @@ type validateOptions struct {
2222
func validateCmd() *cobra.Command {
2323
var opts validateOptions
2424
cmd := &cobra.Command{
25-
Use: "validate [OPTIONS] APP_DEFINITION",
26-
Short: "Check that an App definition (.dockerapp) is syntactically correct",
27-
Example: `$ docker app validate myapp.dockerapp --set key=value --parameters-file myparam.yml`,
28-
Args: cli.RequiresMaxArgs(1),
25+
Use: "validate [OPTIONS] APP_DEFINITION",
26+
Short: "Check that an App definition (.dockerapp) is syntactically correct",
27+
Example: `$ docker app validate myapp.dockerapp --set key=value --parameters-file myparam.yml`,
28+
Args: cli.RequiresMaxArgs(1),
29+
Annotations: map[string]string{"experimental": "true"},
2930
RunE: func(cmd *cobra.Command, args []string) error {
3031
return runValidate(args, opts)
3132
},

vendor/github.com/docker/cli/cli/command/cli.go

Lines changed: 41 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/docker/cli/cli/command/formatter/image.go

Lines changed: 7 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/docker/cli/cli/command/stack/kubernetes/list.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/docker/cli/cli/command/utils.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/docker/cli/cli/compose/convert/compose.go

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/docker/cli/cli/compose/convert/service.go

Lines changed: 7 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)