From a4a70b4506ec4abb8b3bbc3873ee5ca015a8ed08 Mon Sep 17 00:00:00 2001 From: Nalin Dahyabhai Date: Thu, 24 Oct 2019 10:37:22 -0400 Subject: bump containers/image to v5.0.0, buildah to v1.11.4 Move to containers/image v5 and containers/buildah to v1.11.4. Replace an equality check with a type assertion when checking for a docker.ErrUnauthorizedForCredentials in `podman login`. Signed-off-by: Nalin Dahyabhai --- pkg/adapter/containers.go | 2 +- pkg/adapter/pods.go | 2 +- pkg/adapter/runtime.go | 4 ++-- pkg/adapter/runtime_remote.go | 4 ++-- pkg/registries/registries.go | 4 ++-- pkg/spec/createconfig.go | 2 +- pkg/trust/trust.go | 2 +- pkg/util/utils.go | 2 +- pkg/varlinkapi/images.go | 8 ++++---- 9 files changed, 15 insertions(+), 15 deletions(-) (limited to 'pkg') diff --git a/pkg/adapter/containers.go b/pkg/adapter/containers.go index ae91bd812..430b6925d 100644 --- a/pkg/adapter/containers.go +++ b/pkg/adapter/containers.go @@ -16,7 +16,7 @@ import ( "time" "github.com/containers/buildah" - "github.com/containers/image/v4/manifest" + "github.com/containers/image/v5/manifest" "github.com/containers/libpod/cmd/podman/cliconfig" "github.com/containers/libpod/cmd/podman/shared" "github.com/containers/libpod/cmd/podman/shared/parse" diff --git a/pkg/adapter/pods.go b/pkg/adapter/pods.go index ebaaf37ae..9be294929 100644 --- a/pkg/adapter/pods.go +++ b/pkg/adapter/pods.go @@ -11,7 +11,7 @@ import ( "strings" "github.com/containers/buildah/pkg/parse" - "github.com/containers/image/v4/types" + "github.com/containers/image/v5/types" "github.com/containers/libpod/cmd/podman/cliconfig" "github.com/containers/libpod/cmd/podman/shared" "github.com/containers/libpod/libpod" diff --git a/pkg/adapter/runtime.go b/pkg/adapter/runtime.go index 84d43c337..4f70e90f9 100644 --- a/pkg/adapter/runtime.go +++ b/pkg/adapter/runtime.go @@ -14,8 +14,8 @@ import ( "github.com/containers/buildah/imagebuildah" "github.com/containers/buildah/pkg/formats" "github.com/containers/buildah/pkg/parse" - "github.com/containers/image/v4/docker/reference" - "github.com/containers/image/v4/types" + "github.com/containers/image/v5/docker/reference" + "github.com/containers/image/v5/types" "github.com/containers/libpod/cmd/podman/cliconfig" "github.com/containers/libpod/cmd/podman/libpodruntime" "github.com/containers/libpod/cmd/podman/shared" diff --git a/pkg/adapter/runtime_remote.go b/pkg/adapter/runtime_remote.go index 870e86896..fef3986f1 100644 --- a/pkg/adapter/runtime_remote.go +++ b/pkg/adapter/runtime_remote.go @@ -17,8 +17,8 @@ import ( "github.com/containers/buildah/imagebuildah" "github.com/containers/buildah/pkg/formats" - "github.com/containers/image/v4/docker/reference" - "github.com/containers/image/v4/types" + "github.com/containers/image/v5/docker/reference" + "github.com/containers/image/v5/types" "github.com/containers/libpod/cmd/podman/cliconfig" "github.com/containers/libpod/cmd/podman/remoteclientconfig" iopodman "github.com/containers/libpod/cmd/podman/varlink" diff --git a/pkg/registries/registries.go b/pkg/registries/registries.go index b4facef42..9643c947f 100644 --- a/pkg/registries/registries.go +++ b/pkg/registries/registries.go @@ -5,8 +5,8 @@ import ( "path/filepath" "strings" - "github.com/containers/image/v4/pkg/sysregistriesv2" - "github.com/containers/image/v4/types" + "github.com/containers/image/v5/pkg/sysregistriesv2" + "github.com/containers/image/v5/types" "github.com/containers/libpod/pkg/rootless" "github.com/docker/distribution/reference" "github.com/pkg/errors" diff --git a/pkg/spec/createconfig.go b/pkg/spec/createconfig.go index 2addfda4b..2a8fe7332 100644 --- a/pkg/spec/createconfig.go +++ b/pkg/spec/createconfig.go @@ -7,7 +7,7 @@ import ( "strings" "syscall" - "github.com/containers/image/v4/manifest" + "github.com/containers/image/v5/manifest" "github.com/containers/libpod/libpod" "github.com/containers/libpod/libpod/define" "github.com/containers/libpod/pkg/namespaces" diff --git a/pkg/trust/trust.go b/pkg/trust/trust.go index afa89a6e8..b1febbe81 100644 --- a/pkg/trust/trust.go +++ b/pkg/trust/trust.go @@ -11,7 +11,7 @@ import ( "path/filepath" "strings" - "github.com/containers/image/v4/types" + "github.com/containers/image/v5/types" "github.com/pkg/errors" "github.com/sirupsen/logrus" "gopkg.in/yaml.v2" diff --git a/pkg/util/utils.go b/pkg/util/utils.go index d9a84e4e5..71f3e26dc 100644 --- a/pkg/util/utils.go +++ b/pkg/util/utils.go @@ -10,7 +10,7 @@ import ( "time" "github.com/BurntSushi/toml" - "github.com/containers/image/v4/types" + "github.com/containers/image/v5/types" "github.com/containers/libpod/cmd/podman/cliconfig" "github.com/containers/libpod/pkg/errorhandling" "github.com/containers/libpod/pkg/namespaces" diff --git a/pkg/varlinkapi/images.go b/pkg/varlinkapi/images.go index f83b93dff..8d44e6373 100644 --- a/pkg/varlinkapi/images.go +++ b/pkg/varlinkapi/images.go @@ -16,10 +16,10 @@ import ( "github.com/containers/buildah" "github.com/containers/buildah/imagebuildah" - dockerarchive "github.com/containers/image/v4/docker/archive" - "github.com/containers/image/v4/manifest" - "github.com/containers/image/v4/transports/alltransports" - "github.com/containers/image/v4/types" + dockerarchive "github.com/containers/image/v5/docker/archive" + "github.com/containers/image/v5/manifest" + "github.com/containers/image/v5/transports/alltransports" + "github.com/containers/image/v5/types" "github.com/containers/libpod/cmd/podman/shared" "github.com/containers/libpod/cmd/podman/varlink" "github.com/containers/libpod/libpod" -- cgit v1.2.3-54-g00ecf From 07195ff09fdcb0d2d3a044c92665b082d6e742b1 Mon Sep 17 00:00:00 2001 From: Nalin Dahyabhai Date: Wed, 16 Oct 2019 12:00:12 -0400 Subject: API: report multiple digests for images Be prepared to report multiple image digests for images which contain multiple manifests but, because they continue to have the same set of layers and the same configuration, are considered to be the same image. Signed-off-by: Nalin Dahyabhai --- API.md | 2 ++ cmd/podman/images.go | 16 ++++++++++------ cmd/podman/varlink/io.podman.varlink | 3 ++- libpod/image/image.go | 5 +++++ pkg/adapter/runtime_remote.go | 11 +++++++++++ 5 files changed, 30 insertions(+), 7 deletions(-) (limited to 'pkg') diff --git a/API.md b/API.md index e79f6ee5e..d96ea6cd0 100755 --- a/API.md +++ b/API.md @@ -1675,6 +1675,8 @@ id [string](https://godoc.org/builtin#string) digest [string](https://godoc.org/builtin#string) +digests [[]string](#[]string) + parentId [string](https://godoc.org/builtin#string) repoTags [[]string](#[]string) diff --git a/cmd/podman/images.go b/cmd/podman/images.go index e363fa3bb..6bb08e195 100644 --- a/cmd/podman/images.go +++ b/cmd/podman/images.go @@ -27,6 +27,7 @@ type imagesTemplateParams struct { Tag string ID string Digest digest.Digest + Digests []digest.Digest Created string CreatedTime time.Time Size string @@ -34,12 +35,13 @@ type imagesTemplateParams struct { } type imagesJSONParams struct { - ID string `json:"id"` - Name []string `json:"names"` - Digest digest.Digest `json:"digest"` - Created time.Time `json:"created"` - Size *uint64 `json:"size"` - ReadOnly bool `json:"readonly"` + ID string `json:"id"` + Name []string `json:"names"` + Digest digest.Digest `json:"digest"` + Digests []digest.Digest `json:"digests"` + Created time.Time `json:"created"` + Size *uint64 `json:"size"` + ReadOnly bool `json:"readonly"` } type imagesOptions struct { @@ -290,6 +292,7 @@ func getImagesTemplateOutput(ctx context.Context, images []*adapter.ContainerIma Tag: tag, ID: imageID, Digest: img.Digest(), + Digests: img.Digests(), CreatedTime: createdTime, Created: units.HumanDuration(time.Since(createdTime)) + " ago", Size: sizeStr, @@ -321,6 +324,7 @@ func getImagesJSONOutput(ctx context.Context, images []*adapter.ContainerImage) ID: img.ID(), Name: img.Names(), Digest: img.Digest(), + Digests: img.Digests(), Created: img.Created(), Size: size, ReadOnly: img.IsReadOnly(), diff --git a/cmd/podman/varlink/io.podman.varlink b/cmd/podman/varlink/io.podman.varlink index 9ec7d1172..f9339fccb 100644 --- a/cmd/podman/varlink/io.podman.varlink +++ b/cmd/podman/varlink/io.podman.varlink @@ -58,7 +58,8 @@ type VolumeRemoveOpts ( type Image ( id: string, - digest: string, + digest: string, + digests: []string, parentId: string, repoTags: []string, repoDigests: []string, diff --git a/libpod/image/image.go b/libpod/image/image.go index 2ab88f2e9..faa3b648a 100644 --- a/libpod/image/image.go +++ b/libpod/image/image.go @@ -299,6 +299,11 @@ func (i *Image) Digest() digest.Digest { return i.image.Digest } +// Digests returns the image's digests +func (i *Image) Digests() []digest.Digest { + return i.image.Digests +} + // GetManifest returns the image's manifest as a byte array // and manifest type as a string. func (i *Image) GetManifest(ctx context.Context, instanceDigest *digest.Digest) ([]byte, string, error) { diff --git a/pkg/adapter/runtime_remote.go b/pkg/adapter/runtime_remote.go index fef3986f1..12bf550f2 100644 --- a/pkg/adapter/runtime_remote.go +++ b/pkg/adapter/runtime_remote.go @@ -146,6 +146,7 @@ type remoteImage struct { InputName string Names []string Digest digest.Digest + Digests []digest.Digest isParent bool Runtime *LocalRuntime TopLayer string @@ -226,10 +227,15 @@ func imageInListToContainerImage(i iopodman.Image, name string, runtime *LocalRu if err != nil { return nil, err } + var digests []digest.Digest + for _, d := range i.Digests { + digests = append(digests, digest.Digest(d)) + } ri := remoteImage{ InputName: name, ID: i.Id, Digest: digest.Digest(i.Digest), + Digests: digests, Labels: i.Labels, RepoTags: i.RepoTags, RepoDigests: i.RepoTags, @@ -352,6 +358,11 @@ func (ci *ContainerImage) Digest() digest.Digest { return ci.remoteImage.Digest } +// Digests returns the image's digests +func (ci *ContainerImage) Digests() []digest.Digest { + return append([]digest.Digest{}, ci.remoteImage.Digests...) +} + // Labels returns a map of the image's labels func (ci *ContainerImage) Labels(ctx context.Context) (map[string]string, error) { return ci.remoteImage.Labels, nil -- cgit v1.2.3-54-g00ecf From 66c126d6dee178f96f8a120f13372802d46ea9b5 Mon Sep 17 00:00:00 2001 From: Daniel J Walsh Date: Tue, 29 Oct 2019 13:33:44 -0400 Subject: Set default seccomp.json file for podman play kube Currently podman play kube is not using the system default seccomp.json file. This PR will use the default or override location for podman play. Signed-off-by: Daniel J Walsh --- cmd/podman/shared/create.go | 17 ++++------------- libpod/util.go | 17 +++++++++++++++++ pkg/adapter/pods.go | 5 +++++ 3 files changed, 26 insertions(+), 13 deletions(-) (limited to 'pkg') diff --git a/cmd/podman/shared/create.go b/cmd/podman/shared/create.go index 759903c19..dc343e694 100644 --- a/cmd/podman/shared/create.go +++ b/cmd/podman/shared/create.go @@ -251,19 +251,10 @@ func parseSecurityOpt(config *cc.CreateConfig, securityOpts []string, runtime *l } if config.SeccompProfilePath == "" { - if _, err := os.Stat(libpod.SeccompOverridePath); err == nil { - config.SeccompProfilePath = libpod.SeccompOverridePath - } else { - if !os.IsNotExist(err) { - return errors.Wrapf(err, "can't check if %q exists", libpod.SeccompOverridePath) - } - if _, err := os.Stat(libpod.SeccompDefaultPath); err != nil { - if !os.IsNotExist(err) { - return errors.Wrapf(err, "can't check if %q exists", libpod.SeccompDefaultPath) - } - } else { - config.SeccompProfilePath = libpod.SeccompDefaultPath - } + var err error + config.SeccompProfilePath, err = libpod.DefaultSeccompPath() + if err != nil { + return err } } config.LabelOpts = labelOpts diff --git a/libpod/util.go b/libpod/util.go index 84fd490bf..5ae5ab491 100644 --- a/libpod/util.go +++ b/libpod/util.go @@ -189,3 +189,20 @@ func programVersion(mountProgram string) (string, error) { } return strings.TrimSuffix(output, "\n"), nil } + +func DefaultSeccompPath() (string, error) { + _, err := os.Stat(SeccompOverridePath) + if err == nil { + return SeccompOverridePath, nil + } + if !os.IsNotExist(err) { + return "", errors.Wrapf(err, "can't check if %q exists", SeccompOverridePath) + } + if _, err := os.Stat(SeccompDefaultPath); err != nil { + if !os.IsNotExist(err) { + return "", errors.Wrapf(err, "can't check if %q exists", SeccompDefaultPath) + } + return "", nil + } + return SeccompDefaultPath, nil +} diff --git a/pkg/adapter/pods.go b/pkg/adapter/pods.go index 9be294929..d8d5b884f 100644 --- a/pkg/adapter/pods.go +++ b/pkg/adapter/pods.go @@ -713,6 +713,11 @@ func kubeContainerToCreateConfig(ctx context.Context, containerYAML v1.Container } } } + var err error + containerConfig.SeccompProfilePath, err = libpod.DefaultSeccompPath() + if err != nil { + return nil, err + } containerConfig.Command = []string{} if imageData != nil && imageData.Config != nil { -- cgit v1.2.3-54-g00ecf