mirror of
https://github.com/containers/skopeo.git
synced 2025-07-02 09:32:26 +00:00
Merge pull request #793 from JirkaChadima/feat-override-variant
Adds the --override-variant command line flag
This commit is contained in:
commit
e31d5a0e8f
@ -25,6 +25,7 @@ type globalOptions struct {
|
|||||||
registriesDirPath string // Path to a "registries.d" registry configuration directory
|
registriesDirPath string // Path to a "registries.d" registry configuration directory
|
||||||
overrideArch string // Architecture to use for choosing images, instead of the runtime one
|
overrideArch string // Architecture to use for choosing images, instead of the runtime one
|
||||||
overrideOS string // OS to use for choosing images, instead of the runtime one
|
overrideOS string // OS to use for choosing images, instead of the runtime one
|
||||||
|
overrideVariant string // Architecture variant to use for choosing images, instead of the runtime one
|
||||||
commandTimeout time.Duration // Timeout for the command execution
|
commandTimeout time.Duration // Timeout for the command execution
|
||||||
registriesConfPath string // Path to the "registries.conf" file
|
registriesConfPath string // Path to the "registries.conf" file
|
||||||
}
|
}
|
||||||
@ -79,6 +80,11 @@ func createApp() (*cli.App, *globalOptions) {
|
|||||||
Usage: "use `OS` instead of the running OS for choosing images",
|
Usage: "use `OS` instead of the running OS for choosing images",
|
||||||
Destination: &opts.overrideOS,
|
Destination: &opts.overrideOS,
|
||||||
},
|
},
|
||||||
|
cli.StringFlag{
|
||||||
|
Name: "override-variant",
|
||||||
|
Usage: "use `VARIANT` instead of the running architecture variant for choosing images",
|
||||||
|
Destination: &opts.overrideVariant,
|
||||||
|
},
|
||||||
cli.DurationFlag{
|
cli.DurationFlag{
|
||||||
Name: "command-timeout",
|
Name: "command-timeout",
|
||||||
Usage: "timeout for the command execution",
|
Usage: "timeout for the command execution",
|
||||||
|
@ -151,6 +151,7 @@ func (opts *imageOptions) newSystemContext() (*types.SystemContext, error) {
|
|||||||
RegistriesDirPath: opts.global.registriesDirPath,
|
RegistriesDirPath: opts.global.registriesDirPath,
|
||||||
ArchitectureChoice: opts.global.overrideArch,
|
ArchitectureChoice: opts.global.overrideArch,
|
||||||
OSChoice: opts.global.overrideOS,
|
OSChoice: opts.global.overrideOS,
|
||||||
|
VariantChoice: opts.global.overrideVariant,
|
||||||
DockerCertPath: opts.dockerCertPath,
|
DockerCertPath: opts.dockerCertPath,
|
||||||
OCISharedBlobDirPath: opts.sharedBlobDir,
|
OCISharedBlobDirPath: opts.sharedBlobDir,
|
||||||
AuthFilePath: opts.shared.authFilePath,
|
AuthFilePath: opts.shared.authFilePath,
|
||||||
|
@ -53,6 +53,7 @@ func TestImageOptionsNewSystemContext(t *testing.T) {
|
|||||||
"--registries.d", "/srv/registries.d",
|
"--registries.d", "/srv/registries.d",
|
||||||
"--override-arch", "overridden-arch",
|
"--override-arch", "overridden-arch",
|
||||||
"--override-os", "overridden-os",
|
"--override-os", "overridden-os",
|
||||||
|
"--override-variant", "overridden-variant",
|
||||||
}, []string{
|
}, []string{
|
||||||
"--authfile", "/srv/authfile",
|
"--authfile", "/srv/authfile",
|
||||||
"--dest-authfile", "/srv/dest-authfile",
|
"--dest-authfile", "/srv/dest-authfile",
|
||||||
@ -69,6 +70,7 @@ func TestImageOptionsNewSystemContext(t *testing.T) {
|
|||||||
AuthFilePath: "/srv/dest-authfile",
|
AuthFilePath: "/srv/dest-authfile",
|
||||||
ArchitectureChoice: "overridden-arch",
|
ArchitectureChoice: "overridden-arch",
|
||||||
OSChoice: "overridden-os",
|
OSChoice: "overridden-os",
|
||||||
|
VariantChoice: "overridden-variant",
|
||||||
OCISharedBlobDirPath: "/srv/shared-blob-dir",
|
OCISharedBlobDirPath: "/srv/shared-blob-dir",
|
||||||
DockerCertPath: "/srv/cert-dir",
|
DockerCertPath: "/srv/cert-dir",
|
||||||
DockerInsecureSkipTLSVerify: types.OptionalBoolTrue,
|
DockerInsecureSkipTLSVerify: types.OptionalBoolTrue,
|
||||||
@ -163,6 +165,7 @@ func TestImageDestOptionsNewSystemContext(t *testing.T) {
|
|||||||
"--registries.d", "/srv/registries.d",
|
"--registries.d", "/srv/registries.d",
|
||||||
"--override-arch", "overridden-arch",
|
"--override-arch", "overridden-arch",
|
||||||
"--override-os", "overridden-os",
|
"--override-os", "overridden-os",
|
||||||
|
"--override-variant", "overridden-variant",
|
||||||
}, []string{
|
}, []string{
|
||||||
"--authfile", "/srv/authfile",
|
"--authfile", "/srv/authfile",
|
||||||
"--dest-cert-dir", "/srv/cert-dir",
|
"--dest-cert-dir", "/srv/cert-dir",
|
||||||
@ -179,6 +182,7 @@ func TestImageDestOptionsNewSystemContext(t *testing.T) {
|
|||||||
AuthFilePath: "/srv/authfile",
|
AuthFilePath: "/srv/authfile",
|
||||||
ArchitectureChoice: "overridden-arch",
|
ArchitectureChoice: "overridden-arch",
|
||||||
OSChoice: "overridden-os",
|
OSChoice: "overridden-os",
|
||||||
|
VariantChoice: "overridden-variant",
|
||||||
OCISharedBlobDirPath: "/srv/shared-blob-dir",
|
OCISharedBlobDirPath: "/srv/shared-blob-dir",
|
||||||
DockerCertPath: "/srv/cert-dir",
|
DockerCertPath: "/srv/cert-dir",
|
||||||
DockerInsecureSkipTLSVerify: types.OptionalBoolTrue,
|
DockerInsecureSkipTLSVerify: types.OptionalBoolTrue,
|
||||||
|
@ -166,6 +166,7 @@ _skopeo_skopeo() {
|
|||||||
--registries.d
|
--registries.d
|
||||||
--override-arch
|
--override-arch
|
||||||
--override-os
|
--override-os
|
||||||
|
--override-variant
|
||||||
--command-timeout
|
--command-timeout
|
||||||
"
|
"
|
||||||
local boolean_options="
|
local boolean_options="
|
||||||
@ -177,7 +178,7 @@ _skopeo_skopeo() {
|
|||||||
|
|
||||||
case "$prev" in
|
case "$prev" in
|
||||||
# XXX: Changes here need to be refleceted in $options_with_args as well.
|
# XXX: Changes here need to be refleceted in $options_with_args as well.
|
||||||
--policy|--registries.d|--override-arch|--override-os|--command-timeout)
|
--policy|--registries.d|--override-arch|--override-os|--override-variant|--command-timeout)
|
||||||
return
|
return
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
@ -20,7 +20,7 @@ Uses the system's trust policy to validate images, rejects images not trusted by
|
|||||||
**--all**
|
**--all**
|
||||||
|
|
||||||
If _source-image_ refers to a list of images, instead of copying just the image which matches the current OS and
|
If _source-image_ refers to a list of images, instead of copying just the image which matches the current OS and
|
||||||
architecture (subject to the use of the global --override-os and --override-arch options), attempt to copy all of
|
architecture (subject to the use of the global --override-os, --override-arch and --override-variant options), attempt to copy all of
|
||||||
the images in the list, and the list itself.
|
the images in the list, and the list itself.
|
||||||
|
|
||||||
**--authfile** _path_
|
**--authfile** _path_
|
||||||
|
@ -58,6 +58,8 @@ Most commands refer to container images, using a _transport_`:`_details_ format.
|
|||||||
|
|
||||||
**--override-os** _OS_ Use _OS_ instead of the running OS for choosing images.
|
**--override-os** _OS_ Use _OS_ instead of the running OS for choosing images.
|
||||||
|
|
||||||
|
**--override-variant** _VARIANT_ Use _VARIANT_ instead of the running architecture variant for choosing images.
|
||||||
|
|
||||||
**--command-timeout** _duration_ Timeout for the command execution.
|
**--command-timeout** _duration_ Timeout for the command execution.
|
||||||
|
|
||||||
**--help**|**-h** Show help
|
**--help**|**-h** Show help
|
||||||
|
@ -469,7 +469,7 @@ func (s *CopySuite) TestCopyFailsWhenImageOSDoesntMatchRuntimeOS(c *check.C) {
|
|||||||
c.Assert(err, check.IsNil)
|
c.Assert(err, check.IsNil)
|
||||||
defer os.RemoveAll(storage)
|
defer os.RemoveAll(storage)
|
||||||
storage = fmt.Sprintf("[vfs@%s/root+%s/runroot]", storage, storage)
|
storage = fmt.Sprintf("[vfs@%s/root+%s/runroot]", storage, storage)
|
||||||
assertSkopeoFails(c, `.*no image found in manifest list for architecture .*, OS .*`, "copy", knownWindowsOnlyImage, "containers-storage:"+storage+"test")
|
assertSkopeoFails(c, `.*no image found in manifest list for architecture .*, variant .*, OS .*`, "copy", knownWindowsOnlyImage, "containers-storage:"+storage+"test")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *CopySuite) TestCopySucceedsWhenImageDoesntMatchRuntimeButWeOverride(c *check.C) {
|
func (s *CopySuite) TestCopySucceedsWhenImageDoesntMatchRuntimeButWeOverride(c *check.C) {
|
||||||
|
Loading…
Reference in New Issue
Block a user