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

Add "--service-images" to pull command #791

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

doanac
Copy link
Contributor

@doanac doanac commented Jan 10, 2020

This allows users in a single node configuration to optionally pull
down the service images defined in an app bundle with:

docker app pull --service-images [your app]

Fixes: fixes #789

Signed-off-by: Andy Doan andy@foundries.io

func pullCmd(dockerCli command.Cli) *cobra.Command {
var opts pullOptions

cmd := &cobra.Command{
Use: "pull APP_IMAGE",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should also add [OPTIONS] here:

Use: "pull [OPTIONS] APP_IMAGE",

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've force pushed a fix for this.

}
defer responseBody.Close()

return jsonmessage.DisplayJSONMessagesStream(responseBody, cli.Out(), cli.Out().FD(), false, nil)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As those multiple pulls may be really verbose, should we also add a --quiet flag to this command? WDYT @thaJeztah ?

@@ -52,5 +91,15 @@ func runPull(dockerCli command.Cli, name string) error {
}
fmt.Fprintf(os.Stdout, "Successfully pulled %q (%s) from %s\n", bndl.Name, bndl.Version, ref.String())

if opts.serviceImages {
ctx := context.Background()
for name, image := range bndl.Images {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if it makes sense to parallelize pulls here 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me know what you all think. I will warn you that I know just enough about Golang that I might be dangerous doing this bit :)

@silvin-lubecki
Copy link
Contributor

Thank you @doanac for this PR!
By the way the linter is complaining 😅

internal/commands/pull.go:8: File is not `goimports`-ed (goimports)
"github.com/docker/docker/api/types"

This allows users in a single node configuration to optionally pull
down the service images defined in an app bundle with:

 docker app pull --service-images [your app]

Fixes: fixes docker#789

Signed-off-by: Andy Doan <andy@foundries.io>
@codecov
Copy link

codecov bot commented Jan 15, 2020

Codecov Report

Merging #791 into master will decrease coverage by 0.05%.
The diff coverage is 65.51%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #791      +/-   ##
==========================================
- Coverage   70.03%   69.97%   -0.06%     
==========================================
  Files          67       67              
  Lines        3684     3710      +26     
==========================================
+ Hits         2580     2596      +16     
- Misses        759      764       +5     
- Partials      345      350       +5
Impacted Files Coverage Δ
internal/commands/pull.go 62.96% <65.51%> (-1.33%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6d698be...42f1daa. Read the comment docs.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature Request] Support downloading service images with "pull" command
3 participants