From 0913c11c4d4da9d3f8abd87fef78fda63d2a10cd Mon Sep 17 00:00:00 2001 From: taylorhere Date: Tue, 1 Nov 2022 21:19:11 +0800 Subject: [PATCH] feat(builder): add podman support --- pkg/app/context_create.go | 2 +- pkg/buildkitd/buildkitd.go | 2 +- pkg/home/context.go | 3 ++- pkg/types/envd.go | 1 + 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/pkg/app/context_create.go b/pkg/app/context_create.go index bbcf6ef9e..02e93c148 100644 --- a/pkg/app/context_create.go +++ b/pkg/app/context_create.go @@ -35,7 +35,7 @@ var CommandContextCreate = &cli.Command{ }, &cli.StringFlag{ Name: "builder", - Usage: "Builder to use (docker-container, kube-pod, tcp, unix)", + Usage: "Builder to use (docker-container, podman-container, kube-pod, tcp, unix)", Value: string(types.BuilderTypeDocker), }, &cli.StringFlag{ diff --git a/pkg/buildkitd/buildkitd.go b/pkg/buildkitd/buildkitd.go index da28703cb..4ab5282a1 100644 --- a/pkg/buildkitd/buildkitd.go +++ b/pkg/buildkitd/buildkitd.go @@ -113,7 +113,7 @@ func (c generalClient) Close() error { // that can be used to connect to it. func (c *generalClient) maybeStart(ctx context.Context, runningTimeout, connectingTimeout time.Duration) (string, error) { - if c.driver == types.BuilderTypeDocker { + if c.driver == types.BuilderTypeDocker || c.driver == types.BuilderTypePodman { dockerClient, err := docker.NewClient(ctx) if err != nil { return "", err diff --git a/pkg/home/context.go b/pkg/home/context.go index 6b6f250a5..b57ad381f 100644 --- a/pkg/home/context.go +++ b/pkg/home/context.go @@ -96,7 +96,8 @@ func (m *generalManager) ContextCreate(ctx types.Context, use bool) error { } switch ctx.Builder { case types.BuilderTypeDocker, types.BuilderTypeKubernetes, - types.BuilderTypeUNIXDomainSocket, types.BuilderTypeTCP: + types.BuilderTypeUNIXDomainSocket, types.BuilderTypeTCP, + types.BuilderTypePodman: break default: return errors.New("unknown builder type") diff --git a/pkg/types/envd.go b/pkg/types/envd.go index c9422b097..dfde36081 100644 --- a/pkg/types/envd.go +++ b/pkg/types/envd.go @@ -129,6 +129,7 @@ type BuilderType string const ( BuilderTypeDocker BuilderType = "docker-container" + BuilderTypePodman BuilderType = "podman-container" BuilderTypeKubernetes BuilderType = "kube-pod" BuilderTypeTCP BuilderType = "tcp" BuilderTypeUNIXDomainSocket BuilderType = "unix"