diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-04-27 15:33:00 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-27 15:33:00 +0200 |
commit | ef46687dc5bd3eff7b2e75a347f1b026c3b50f33 (patch) | |
tree | d84ba00b5cc4661f1cba70f1f6ec1e3893a9fe30 | |
parent | a5bce57218d7a3067e75028b237f92e0230969c3 (diff) | |
parent | 2f3734b143a6f1d61e396ca221a211b7c487d081 (diff) | |
download | podman-ef46687dc5bd3eff7b2e75a347f1b026c3b50f33.tar.gz podman-ef46687dc5bd3eff7b2e75a347f1b026c3b50f33.tar.bz2 podman-ef46687dc5bd3eff7b2e75a347f1b026c3b50f33.zip |
Merge pull request #5976 from QiWang19/manifest-add-os
Add --os to manifest add
-rw-r--r-- | cmd/podman/manifest/add.go | 1 | ||||
-rw-r--r-- | completions/bash/podman | 1 | ||||
-rw-r--r-- | docs/source/markdown/podman-manifest-add.1.md | 7 | ||||
-rw-r--r-- | libpod/image/manifests.go | 6 | ||||
-rw-r--r-- | pkg/domain/entities/manifest.go | 1 | ||||
-rw-r--r-- | pkg/domain/infra/abi/manifest.go | 1 | ||||
-rw-r--r-- | pkg/domain/infra/tunnel/manifest.go | 1 | ||||
-rw-r--r-- | test/e2e/manifest_test.go | 13 |
8 files changed, 31 insertions, 0 deletions
diff --git a/cmd/podman/manifest/add.go b/cmd/podman/manifest/add.go index 20251ca87..c83beff7a 100644 --- a/cmd/podman/manifest/add.go +++ b/cmd/podman/manifest/add.go @@ -34,6 +34,7 @@ func init() { flags.StringSliceVar(&manifestAddOpts.Annotation, "annotation", nil, "set an `annotation` for the specified image") flags.StringVar(&manifestAddOpts.Arch, "arch", "", "override the `architecture` of the specified image") flags.StringSliceVar(&manifestAddOpts.Features, "features", nil, "override the `features` of the specified image") + flags.StringVar(&manifestAddOpts.OS, "os", "", "override the `OS` of the specified image") flags.StringVar(&manifestAddOpts.OSVersion, "os-version", "", "override the OS `version` of the specified image") flags.StringVar(&manifestAddOpts.Variant, "variant", "", "override the `Variant` of the specified image") } diff --git a/completions/bash/podman b/completions/bash/podman index 41a76a967..d6e9408c6 100644 --- a/completions/bash/podman +++ b/completions/bash/podman @@ -1760,6 +1760,7 @@ _podman_manifest_add() { --annotation --arch --features + --os --os-version --variant " diff --git a/docs/source/markdown/podman-manifest-add.1.md b/docs/source/markdown/podman-manifest-add.1.md index 4ecf03900..857a98e12 100644 --- a/docs/source/markdown/podman-manifest-add.1.md +++ b/docs/source/markdown/podman-manifest-add.1.md @@ -38,6 +38,13 @@ retrieved from the image's configuration information. Specify the features list which the list or index records as requirements for the image. This option is rarely used. +**--os** + +Override the OS which the list or index records as a requirement for the image. +If *imagename* refers to a manifest list or image index, the OS information +will be retrieved from it. Otherwise, it will be retrieved from the image's +configuration information. + **--os-version** Specify the OS version which the list or index records as a requirement for the diff --git a/libpod/image/manifests.go b/libpod/image/manifests.go index 9dbeb4cc5..7ca17f86c 100644 --- a/libpod/image/manifests.go +++ b/libpod/image/manifests.go @@ -19,6 +19,7 @@ type ManifestAddOpts struct { Arch string `json:"arch"` Features []string `json:"features"` Images []string `json:"images"` + OS string `json:"os"` OSVersion string `json:"os_version"` Variant string `json:"variant"` } @@ -86,6 +87,11 @@ func addManifestToList(ref types.ImageReference, list manifests.List, systemCont if err != nil { return nil, err } + if opts.OS != "" { + if err := list.SetOS(d, opts.OS); err != nil { + return nil, err + } + } if len(opts.OSVersion) > 0 { if err := list.SetOSVersion(d, opts.OSVersion); err != nil { return nil, err diff --git a/pkg/domain/entities/manifest.go b/pkg/domain/entities/manifest.go index a9c961f9d..7316735b0 100644 --- a/pkg/domain/entities/manifest.go +++ b/pkg/domain/entities/manifest.go @@ -10,6 +10,7 @@ type ManifestAddOptions struct { Arch string `json:"arch" schema:"arch"` Features []string `json:"features" schema:"features"` Images []string `json:"images" schema:"images"` + OS string `json:"os" schema:"os"` OSVersion string `json:"os_version" schema:"os_version"` Variant string `json:"variant" schema:"variant"` } diff --git a/pkg/domain/infra/abi/manifest.go b/pkg/domain/infra/abi/manifest.go index 27d4bf9a5..88331f96c 100644 --- a/pkg/domain/infra/abi/manifest.go +++ b/pkg/domain/infra/abi/manifest.go @@ -79,6 +79,7 @@ func (ir *ImageEngine) ManifestAdd(ctx context.Context, opts entities.ManifestAd Arch: opts.Arch, Features: opts.Features, Images: opts.Images, + OS: opts.OS, OSVersion: opts.OSVersion, Variant: opts.Variant, } diff --git a/pkg/domain/infra/tunnel/manifest.go b/pkg/domain/infra/tunnel/manifest.go index 338256530..18b400533 100644 --- a/pkg/domain/infra/tunnel/manifest.go +++ b/pkg/domain/infra/tunnel/manifest.go @@ -41,6 +41,7 @@ func (ir *ImageEngine) ManifestAdd(ctx context.Context, opts entities.ManifestAd Arch: opts.Arch, Features: opts.Features, Images: opts.Images, + OS: opts.OS, OSVersion: opts.OSVersion, Variant: opts.Variant, } diff --git a/test/e2e/manifest_test.go b/test/e2e/manifest_test.go index a52916e87..9b5a24771 100644 --- a/test/e2e/manifest_test.go +++ b/test/e2e/manifest_test.go @@ -85,4 +85,17 @@ var _ = Describe("Podman manifest", func() { Expect(session.OutputToString()).To(ContainSubstring(imageListPPC64LEInstanceDigest)) Expect(session.OutputToString()).To(ContainSubstring(imageListS390XInstanceDigest)) }) + + It("podman manifest add --os", func() { + session := podmanTest.Podman([]string{"manifest", "create", "foo"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + session = podmanTest.Podman([]string{"manifest", "add", "--os", "bar", "foo", imageList}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + session = podmanTest.Podman([]string{"manifest", "inspect", "foo"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + Expect(session.OutputToString()).To(ContainSubstring(`"os": "bar"`)) + }) }) |