summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQi Wang <qiwan@redhat.com>2020-04-24 14:54:30 -0400
committerQi Wang <qiwan@redhat.com>2020-04-24 14:57:56 -0400
commit2f3734b143a6f1d61e396ca221a211b7c487d081 (patch)
tree58c5c6f3effe94a73e2a9ece8d20aeac8a209586
parent3c3adac52838bc4d2b0fdda2cbb8366c81444728 (diff)
downloadpodman-2f3734b143a6f1d61e396ca221a211b7c487d081.tar.gz
podman-2f3734b143a6f1d61e396ca221a211b7c487d081.tar.bz2
podman-2f3734b143a6f1d61e396ca221a211b7c487d081.zip
Add --os to manifest add
Add --os to manifest add for overriding the os field. Signed-off-by: Qi Wang <qiwan@redhat.com>
-rw-r--r--cmd/podman/manifest/add.go1
-rw-r--r--completions/bash/podman1
-rw-r--r--docs/source/markdown/podman-manifest-add.1.md7
-rw-r--r--libpod/image/manifests.go6
-rw-r--r--pkg/domain/entities/manifest.go1
-rw-r--r--pkg/domain/infra/abi/manifest.go1
-rw-r--r--pkg/domain/infra/tunnel/manifest.go1
-rw-r--r--test/e2e/manifest_test.go13
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"`))
+ })
})