From 675d775eb54f1614a542dfcbbc5a4aa857cc0db0 Mon Sep 17 00:00:00 2001 From: Daniel J Walsh Date: Mon, 21 Feb 2022 17:12:22 -0500 Subject: 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 --- pkg/domain/infra/abi/play.go | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'pkg/domain/infra/abi') 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 { -- cgit v1.2.3-54-g00ecf