@@ -103,13 +103,20 @@ func (s *CopySuite) TestCopyWithManifestList(c *check.C) {
103103 assertSkopeoSucceeds (c , "" , "copy" , knownListImage , "dir:" + dir )
104104}
105105
106- func (s * CopySuite ) TestCopyAllWithManifestList (c * check.C ) {
106+ func (s * CopySuite ) TestCopyAllFlagWithManifestList (c * check.C ) {
107107 dir , err := ioutil .TempDir ("" , "copy-all-manifest-list" )
108108 c .Assert (err , check .IsNil )
109109 defer os .RemoveAll (dir )
110110 assertSkopeoSucceeds (c , "" , "copy" , "--all" , knownListImage , "dir:" + dir )
111111}
112112
113+ func (s * CopySuite ) TestCopyAllWithManifestList (c * check.C ) {
114+ dir , err := ioutil .TempDir ("" , "copy-all-manifest-list" )
115+ c .Assert (err , check .IsNil )
116+ defer os .RemoveAll (dir )
117+ assertSkopeoSucceeds (c , "" , "copy" , "--multi-arch=all" , knownListImage , "dir:" + dir )
118+ }
119+
113120func (s * CopySuite ) TestCopyAllWithManifestListRoundTrip (c * check.C ) {
114121 oci1 , err := ioutil .TempDir ("" , "copy-all-manifest-list-oci" )
115122 c .Assert (err , check .IsNil )
@@ -123,10 +130,10 @@ func (s *CopySuite) TestCopyAllWithManifestListRoundTrip(c *check.C) {
123130 dir2 , err := ioutil .TempDir ("" , "copy-all-manifest-list-dir" )
124131 c .Assert (err , check .IsNil )
125132 defer os .RemoveAll (dir2 )
126- assertSkopeoSucceeds (c , "" , "copy" , "--all" , knownListImage , "oci:" + oci1 )
127- assertSkopeoSucceeds (c , "" , "copy" , "--all" , "oci:" + oci1 , "dir:" + dir1 )
128- assertSkopeoSucceeds (c , "" , "copy" , "--all" , "dir:" + dir1 , "oci:" + oci2 )
129- assertSkopeoSucceeds (c , "" , "copy" , "--all" , "oci:" + oci2 , "dir:" + dir2 )
133+ assertSkopeoSucceeds (c , "" , "copy" , "--multi-arch= all" , knownListImage , "oci:" + oci1 )
134+ assertSkopeoSucceeds (c , "" , "copy" , "--multi-arch= all" , "oci:" + oci1 , "dir:" + dir1 )
135+ assertSkopeoSucceeds (c , "" , "copy" , "--multi-arch= all" , "dir:" + dir1 , "oci:" + oci2 )
136+ assertSkopeoSucceeds (c , "" , "copy" , "--multi-arch= all" , "oci:" + oci2 , "dir:" + dir2 )
130137 assertDirImagesAreEqual (c , dir1 , dir2 )
131138 out := combinedOutputOfCommand (c , "diff" , "-urN" , oci1 , oci2 )
132139 c .Assert (out , check .Equals , "" )
@@ -145,15 +152,30 @@ func (s *CopySuite) TestCopyAllWithManifestListConverge(c *check.C) {
145152 dir2 , err := ioutil .TempDir ("" , "copy-all-manifest-list-dir" )
146153 c .Assert (err , check .IsNil )
147154 defer os .RemoveAll (dir2 )
148- assertSkopeoSucceeds (c , "" , "copy" , "--all" , knownListImage , "oci:" + oci1 )
149- assertSkopeoSucceeds (c , "" , "copy" , "--all" , "oci:" + oci1 , "dir:" + dir1 )
150- assertSkopeoSucceeds (c , "" , "copy" , "--all" , "--format" , "oci" , knownListImage , "dir:" + dir2 )
151- assertSkopeoSucceeds (c , "" , "copy" , "--all" , "dir:" + dir2 , "oci:" + oci2 )
155+ assertSkopeoSucceeds (c , "" , "copy" , "--multi-arch= all" , knownListImage , "oci:" + oci1 )
156+ assertSkopeoSucceeds (c , "" , "copy" , "--multi-arch= all" , "oci:" + oci1 , "dir:" + dir1 )
157+ assertSkopeoSucceeds (c , "" , "copy" , "--multi-arch= all" , "--format" , "oci" , knownListImage , "dir:" + dir2 )
158+ assertSkopeoSucceeds (c , "" , "copy" , "--multi-arch= all" , "dir:" + dir2 , "oci:" + oci2 )
152159 assertDirImagesAreEqual (c , dir1 , dir2 )
153160 out := combinedOutputOfCommand (c , "diff" , "-urN" , oci1 , oci2 )
154161 c .Assert (out , check .Equals , "" )
155162}
156163
164+ func (s * CopySuite ) TestCopyNoneWithManifestList (c * check.C ) {
165+ dir1 , err := ioutil .TempDir ("" , "copy-all-manifest-list-dir" )
166+ c .Assert (err , check .IsNil )
167+ defer os .RemoveAll (dir1 )
168+ assertSkopeoSucceeds (c , "" , "copy" , "--multi-arch=index-only" , knownListImage , "dir:" + dir1 )
169+
170+ manifestPath := filepath .Join (dir1 , "manifest.json" )
171+ readManifest , err := ioutil .ReadFile (manifestPath )
172+ c .Assert (err , check .IsNil )
173+ mimeType := manifest .GuessMIMEType (readManifest )
174+ c .Assert (mimeType , check .Equals , "application/vnd.docker.distribution.manifest.list.v2+json" )
175+ out := combinedOutputOfCommand (c , "ls" , "-1" , dir1 )
176+ c .Assert (out , check .Equals , "manifest.json\n version\n " )
177+ }
178+
157179func (s * CopySuite ) TestCopyWithManifestListConverge (c * check.C ) {
158180 oci1 , err := ioutil .TempDir ("" , "copy-all-manifest-list-oci" )
159181 c .Assert (err , check .IsNil )
@@ -168,9 +190,9 @@ func (s *CopySuite) TestCopyWithManifestListConverge(c *check.C) {
168190 c .Assert (err , check .IsNil )
169191 defer os .RemoveAll (dir2 )
170192 assertSkopeoSucceeds (c , "" , "copy" , knownListImage , "oci:" + oci1 )
171- assertSkopeoSucceeds (c , "" , "copy" , "--all" , "oci:" + oci1 , "dir:" + dir1 )
193+ assertSkopeoSucceeds (c , "" , "copy" , "--multi-arch= all" , "oci:" + oci1 , "dir:" + dir1 )
172194 assertSkopeoSucceeds (c , "" , "copy" , "--format" , "oci" , knownListImage , "dir:" + dir2 )
173- assertSkopeoSucceeds (c , "" , "copy" , "--all" , "dir:" + dir2 , "oci:" + oci2 )
195+ assertSkopeoSucceeds (c , "" , "copy" , "--multi-arch= all" , "dir:" + dir2 , "oci:" + oci2 )
174196 assertDirImagesAreEqual (c , dir1 , dir2 )
175197 out := combinedOutputOfCommand (c , "diff" , "-urN" , oci1 , oci2 )
176198 c .Assert (out , check .Equals , "" )
@@ -181,7 +203,7 @@ func (s *CopySuite) TestCopyAllWithManifestListStorageFails(c *check.C) {
181203 c .Assert (err , check .IsNil )
182204 defer os .RemoveAll (storage )
183205 storage = fmt .Sprintf ("[vfs@%s/root+%s/runroot]" , storage , storage )
184- assertSkopeoFails (c , `.*destination transport .* does not support copying multiple images as a group.*` , "copy" , "--all" , knownListImage , "containers-storage:" + storage + "test" )
206+ assertSkopeoFails (c , `.*destination transport .* does not support copying multiple images as a group.*` , "copy" , "--multi-arch= all" , knownListImage , "containers-storage:" + storage + "test" )
185207}
186208
187209func (s * CopySuite ) TestCopyWithManifestListStorage (c * check.C ) {
@@ -239,7 +261,7 @@ func (s *CopySuite) TestCopyWithManifestListDigest(c *check.C) {
239261 c .Assert (err , check .IsNil )
240262 digest := manifestDigest .String ()
241263 assertSkopeoSucceeds (c , "" , "copy" , knownListImage + "@" + digest , "dir:" + dir1 )
242- assertSkopeoSucceeds (c , "" , "copy" , "--all" , knownListImage + "@" + digest , "dir:" + dir2 )
264+ assertSkopeoSucceeds (c , "" , "copy" , "--multi-arch= all" , knownListImage + "@" + digest , "dir:" + dir2 )
243265 assertSkopeoSucceeds (c , "" , "copy" , "dir:" + dir1 , "oci:" + oci1 )
244266 assertSkopeoSucceeds (c , "" , "copy" , "dir:" + dir2 , "oci:" + oci2 )
245267 out := combinedOutputOfCommand (c , "diff" , "-urN" , oci1 , oci2 )
0 commit comments