mirror of https://github.com/knative/func.git
fix: ban podman 4.3 for pack build (#1563)
Signed-off-by: Matej Vasek <mvasek@redhat.com>
This commit is contained in:
parent
6d4565158b
commit
138d1e46c5
|
@ -8,6 +8,7 @@ import (
|
|||
"runtime"
|
||||
"strings"
|
||||
|
||||
"github.com/Masterminds/semver"
|
||||
pack "github.com/buildpacks/pack/pkg/client"
|
||||
"github.com/buildpacks/pack/pkg/logging"
|
||||
"github.com/docker/docker/client"
|
||||
|
@ -144,6 +145,10 @@ func (b *Builder) Build(ctx context.Context, f fn.Function) (err error) {
|
|||
defer cli.Close()
|
||||
opts.DockerHost = dockerHost
|
||||
|
||||
if ok, _ := isPodmanV43(ctx, cli); ok {
|
||||
return fmt.Errorf("podman 4.3 is not supported, use podman 4.2 or 4.4")
|
||||
}
|
||||
|
||||
// Client with a logger which is enabled if in Verbose mode and a dockerClient that supports SSH docker daemon connection.
|
||||
if impl, err = pack.NewClient(pack.WithLogger(b.logger), pack.WithDockerClient(cli)); err != nil {
|
||||
return fmt.Errorf("cannot create pack client: %w", err)
|
||||
|
@ -164,6 +169,24 @@ func (b *Builder) Build(ctx context.Context, f fn.Function) (err error) {
|
|||
return
|
||||
}
|
||||
|
||||
func isPodmanV43(ctx context.Context, cli client.CommonAPIClient) (b bool, err error) {
|
||||
version, err := cli.ServerVersion(ctx)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
for _, component := range version.Components {
|
||||
if component.Name == "Podman Engine" {
|
||||
v := semver.MustParse(version.Version)
|
||||
if v.Major() == 4 && v.Minor() == 3 {
|
||||
return true, nil
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// TrustBuilder determines whether the builder image should be trusted
|
||||
// based on a set of trusted builder image registry prefixes.
|
||||
func TrustBuilder(b string) bool {
|
||||
|
|
Loading…
Reference in New Issue