This repository has been archived by the owner on Jun 13, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 176
Transform docker-app as a docker-cli plugin #469
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
ac854b9
Convert docker-app to a docker cli plugin
silvin-lubecki 2475ad2
Move all the commands to their own package internal/commands so they …
silvin-lubecki 3930fe7
Add a new binary docker-app-standalone
silvin-lubecki eee6fb5
Update README with the plugin installation
silvin-lubecki 80357fa
Fix CI issues
b8e5ce5
Remove BUILDKIT=true from Jenkinsfile
ulyssessouza 90010ff
Fix the version the of the CLI
ulyssessouza 064a917
Fix e2e binaries path and cli vendor override
ulyssessouza 9678c4b
Fix EXPERIMENTAL=on tests
ulyssessouza c9c81eb
Make e2e test arguments uniform
ulyssessouza 02db9b4
Fix plugins related text in README.md
ulyssessouza 30fda72
Use unique config for each test
ulyssessouza File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
|
||
"github.com/spf13/cobra" | ||
"github.com/spf13/pflag" | ||
|
||
"github.com/docker/app/internal" | ||
app "github.com/docker/app/internal/commands" | ||
"github.com/docker/cli/cli" | ||
"github.com/docker/cli/cli/command" | ||
cliflags "github.com/docker/cli/cli/flags" | ||
"github.com/sirupsen/logrus" | ||
) | ||
|
||
func main() { | ||
dockerCli, err := command.NewDockerCli() | ||
if err != nil { | ||
fmt.Fprintln(os.Stderr, err) | ||
} | ||
logrus.SetOutput(dockerCli.Err()) | ||
|
||
cmd := app.NewRootCmd("docker-app", dockerCli) | ||
configureRootCmd(cmd, dockerCli) | ||
|
||
if err := cmd.Execute(); err != nil { | ||
os.Exit(1) | ||
} | ||
} | ||
|
||
func configureRootCmd(cmd *cobra.Command, dockerCli *command.DockerCli) { | ||
var ( | ||
opts *cliflags.ClientOptions | ||
flags *pflag.FlagSet | ||
) | ||
|
||
cmd.SilenceUsage = true | ||
cmd.TraverseChildren = true | ||
cmd.PersistentPreRunE = func(cmd *cobra.Command, args []string) error { | ||
opts.Common.SetDefaultOptions(flags) | ||
return dockerCli.Initialize(opts) | ||
} | ||
cmd.Version = fmt.Sprintf("%s, build %s", internal.Version, internal.GitCommit) | ||
|
||
opts, flags, _ = cli.SetupRootCommand(cmd) | ||
flags.BoolP("version", "v", false, "Print version information") | ||
cmd.SetVersionTemplate("docker-app version {{.Version}}\n") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,20 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
|
||
"github.com/docker/app/internal" | ||
app "github.com/docker/app/internal/commands" | ||
"github.com/docker/cli/cli-plugins/manager" | ||
"github.com/docker/cli/cli-plugins/plugin" | ||
"github.com/docker/cli/cli/command" | ||
"github.com/sirupsen/logrus" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
func main() { | ||
dockerCli, err := command.NewDockerCli() | ||
if err != nil { | ||
fmt.Fprintln(os.Stderr, err) | ||
os.Exit(1) | ||
} | ||
logrus.SetOutput(dockerCli.Err()) | ||
cmd := newRootCmd(dockerCli) | ||
if err := cmd.Execute(); err != nil { | ||
os.Exit(1) | ||
} | ||
plugin.Run(func(dockerCli command.Cli) *cobra.Command { | ||
return app.NewRootCmd("app", dockerCli) | ||
}, manager.Metadata{ | ||
SchemaVersion: "0.1.0", | ||
Vendor: "Docker Inc.", | ||
Version: internal.Version, | ||
}) | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Must remember to bump the version when we do a release.