summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2022-02-21 17:12:22 -0500
committerDaniel J Walsh <dwalsh@redhat.com>2022-03-01 08:47:09 -0500
commit675d775eb54f1614a542dfcbbc5a4aa857cc0db0 (patch)
tree38e8d87f56d418a6760e7a30df76c56a6f939247 /cmd
parent8bdda91ab738d634528259581c8adebe1db007b4 (diff)
downloadpodman-675d775eb54f1614a542dfcbbc5a4aa857cc0db0.tar.gz
podman-675d775eb54f1614a542dfcbbc5a4aa857cc0db0.tar.bz2
podman-675d775eb54f1614a542dfcbbc5a4aa857cc0db0.zip
Add --context-dir option to podman play kube
This option was requested so that users could specify alternate locations to find context directories for each image build. It requites the --build option to be set. Partion Fix: https://github.com/containers/podman/issues/12485 Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'cmd')
-rw-r--r--cmd/podman/play/kube.go9
1 files changed, 7 insertions, 2 deletions
diff --git a/cmd/podman/play/kube.go b/cmd/podman/play/kube.go
index 1a430f2dc..563a6251c 100644
--- a/cmd/podman/play/kube.go
+++ b/cmd/podman/play/kube.go
@@ -119,9 +119,11 @@ func init() {
buildFlagName := "build"
flags.BoolVar(&kubeOptions.BuildCLI, buildFlagName, false, "Build all images in a YAML (given Containerfiles exist)")
- }
- if !registry.IsRemote() {
+ contextDirFlagName := "context-dir"
+ flags.StringVar(&kubeOptions.ContextDir, contextDirFlagName, "", "Path to top level of context directory")
+ _ = kubeCmd.RegisterFlagCompletionFunc(contextDirFlagName, completion.AutocompleteDefault)
+
flags.StringVar(&kubeOptions.SignaturePolicy, "signature-policy", "", "`Pathname` of signature policy file (not usually used)")
_ = flags.MarkHidden("signature-policy")
@@ -147,6 +149,9 @@ func kube(cmd *cobra.Command, args []string) error {
return err
}
}
+ if kubeOptions.ContextDir != "" && kubeOptions.Build != types.OptionalBoolTrue {
+ return errors.New("--build must be specified when using --context-dir option")
+ }
if kubeOptions.CredentialsCLI != "" {
creds, err := util.ParseRegistryCreds(kubeOptions.CredentialsCLI)
if err != nil {