mirror of
https://github.com/containers/skopeo.git
synced 2025-09-09 02:29:49 +00:00
Adds the --override-variant command line flag
Signed-off-by: Jirka Chadima <chadima.jiri@gmail.com>
This commit is contained in:
@@ -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",
|
||||||
|
@@ -136,6 +136,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,
|
||||||
|
@@ -52,6 +52,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-cert-dir", "/srv/cert-dir",
|
"--dest-cert-dir", "/srv/cert-dir",
|
||||||
@@ -67,6 +68,7 @@ func TestImageOptionsNewSystemContext(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,
|
||||||
@@ -149,6 +151,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",
|
||||||
@@ -165,6 +168,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,
|
||||||
|
@@ -150,6 +150,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="
|
||||||
@@ -161,7 +162,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
|
||||||
|
@@ -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) {
|
||||||
|
Reference in New Issue
Block a user