... | ... |
@@ -12013,6 +12013,7 @@ _openshift_cli_ex_dockerbuild() |
12013 | 12013 |
flags_with_completion=() |
12014 | 12014 |
flags_completion=() |
12015 | 12015 |
|
12016 |
+ flags+=("--allow-pull") |
|
12016 | 12017 |
flags+=("--dockerfile=") |
12017 | 12018 |
flags_with_completion+=("--dockerfile") |
12018 | 12019 |
flags_completion+=("_filedir") |
... | ... |
@@ -39,6 +39,7 @@ type DockerbuildOptions struct { |
39 | 39 |
Directory string |
40 | 40 |
Tag string |
41 | 41 |
DockerfilePath string |
42 |
+ AllowPull bool |
|
42 | 43 |
Keyring credentialprovider.DockerKeyring |
43 | 44 |
Arguments cmdutil.Environment |
44 | 45 |
} |
... | ... |
@@ -67,6 +68,7 @@ func NewCmdDockerbuild(fullName string, f *clientcmd.Factory, out, errOut io.Wri |
67 | 67 |
} |
68 | 68 |
|
69 | 69 |
cmd.Flags().StringVar(&options.DockerfilePath, "dockerfile", options.DockerfilePath, "An optional path to a Dockerfile to use.") |
70 |
+ cmd.Flags().BoolVar(&options.AllowPull, "allow-pull", true, "Pull the images that are not present.") |
|
70 | 71 |
cmd.MarkFlagFilename("dockerfile") |
71 | 72 |
|
72 | 73 |
return cmd |
... | ... |
@@ -109,6 +111,7 @@ func (o *DockerbuildOptions) Run() error { |
109 | 109 |
defer f.Close() |
110 | 110 |
e := builder.NewClientExecutor(o.Client) |
111 | 111 |
e.Out, e.ErrOut = o.Out, o.Err |
112 |
+ e.AllowPull = o.AllowPull |
|
112 | 113 |
e.Directory = o.Directory |
113 | 114 |
e.Tag = o.Tag |
114 | 115 |
e.AuthFn = o.Keyring.Lookup |
... | ... |
@@ -284,7 +284,8 @@ func (e *ClientExecutor) LoadImage(from string) (*docker.Image, error) { |
284 | 284 |
var lastErr error |
285 | 285 |
for _, config := range auth { |
286 | 286 |
// TODO: handle IDs? |
287 |
- if err = e.Client.PullImage(docker.PullImageOptions{Repository: from}, config); err == nil { |
|
287 |
+ // TODO: use RawJSONStream:true and handle the output nicely |
|
288 |
+ if err = e.Client.PullImage(docker.PullImageOptions{Repository: from, OutputStream: e.Out}, config); err == nil { |
|
288 | 289 |
break |
289 | 290 |
} |
290 | 291 |
lastErr = err |