summaryrefslogtreecommitdiff
path: root/pkg/domain
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 /pkg/domain
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 'pkg/domain')
-rw-r--r--pkg/domain/entities/play.go2
-rw-r--r--pkg/domain/infra/abi/play.go12
2 files changed, 11 insertions, 3 deletions
diff --git a/pkg/domain/entities/play.go b/pkg/domain/entities/play.go
index 43fa3a712..7614a4012 100644
--- a/pkg/domain/entities/play.go
+++ b/pkg/domain/entities/play.go
@@ -14,6 +14,8 @@ type PlayKubeOptions struct {
Build types.OptionalBool
// CertDir - to a directory containing TLS certifications and keys.
CertDir string
+ // ContextDir - directory containing image contexts used for Build
+ ContextDir string
// Down indicates whether to bring contents of a yaml file "down"
// as in stop
Down bool
diff --git a/pkg/domain/infra/abi/play.go b/pkg/domain/infra/abi/play.go
index 8cbf5da9a..213d8ceb7 100644
--- a/pkg/domain/infra/abi/play.go
+++ b/pkg/domain/infra/abi/play.go
@@ -354,9 +354,15 @@ func (ic *ContainerEngine) playKubePod(ctx context.Context, podName string, podY
containers := make([]*libpod.Container, 0, len(podYAML.Spec.Containers))
initContainers := make([]*libpod.Container, 0, len(podYAML.Spec.InitContainers))
- cwd, err := os.Getwd()
- if err != nil {
- return nil, err
+
+ var cwd string
+ if options.ContextDir != "" {
+ cwd = options.ContextDir
+ } else {
+ cwd, err = os.Getwd()
+ if err != nil {
+ return nil, err
+ }
}
for _, initCtr := range podYAML.Spec.InitContainers {