Skip to content

Commit

Permalink
Merge pull request openshift#18078 from smarterclayton/fix_mirror
Browse files Browse the repository at this point in the history
Automatic merge from submit-queue.

`oc image mirror` was accidentally broken during dependency updating

An upstream cherry-pick was dropped and the wrong values were passed to the manifest Get call.

@liggitt
  • Loading branch information
openshift-merge-robot authored Jan 17, 2018
2 parents d5175c1 + 729d5f5 commit 78ddc10
Show file tree
Hide file tree
Showing 5 changed files with 99 additions and 6 deletions.
4 changes: 4 additions & 0 deletions glide.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ import:
- package: github.com/opencontainers/runc
repo: [email protected]:openshift/opencontainers-runc
version: openshift-3.9
# cli
- package: github.com/docker/distribution
repo: [email protected]:openshift/docker-distribution
version: release-2.6.0

# ours: shared with kube, but forced by openshift
# master
Expand Down
9 changes: 7 additions & 2 deletions pkg/oc/cli/cmd/image/mirror/mirror.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,12 @@ type pushOptions struct {
AttemptS3BucketCopy []string
}

// schema2ManifestOnly specifically requests a manifest list first
var schema2ManifestOnly = distribution.WithManifestMediaTypes([]string{
manifestlist.MediaTypeManifestList,
schema2.MediaTypeManifest,
})

// NewCommandMirrorImage copies images from one location to another.
func NewCmdMirrorImage(name string, out, errOut io.Writer) *cobra.Command {
o := &pushOptions{}
Expand Down Expand Up @@ -398,8 +404,7 @@ func (o *pushOptions) Run() error {
for srcDigestString, pushTargets := range src.digests {
// load the manifest
srcDigest := godigest.Digest(srcDigestString)
// var contentDigest godigest.Digest / client.ReturnContentDigest(&contentDigest),
srcManifest, err := manifests.Get(ctx, godigest.Digest(srcDigest), distribution.WithTag(manifestlist.MediaTypeManifestList), distribution.WithTag(schema2.MediaTypeManifest))
srcManifest, err := manifests.Get(ctx, godigest.Digest(srcDigest), schema2ManifestOnly)
if err != nil {
digestErrs = append(digestErrs, retrieverError{src: src.ref, err: fmt.Errorf("unable to retrieve source image %s manifest: %v", src.ref, err)})
continue
Expand Down
15 changes: 15 additions & 0 deletions vendor/github.com/docker/distribution/registry.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 78ddc10

Please sign in to comment.