Skip to content
This repository has been archived by the owner on Oct 10, 2020. It is now read-only.

Labels are not always parsed correctly #1173

Open
ashcrow opened this issue Feb 1, 2018 · 2 comments
Open

Labels are not always parsed correctly #1173

ashcrow opened this issue Feb 1, 2018 · 2 comments

Comments

@ashcrow
Copy link
Contributor

ashcrow commented Feb 1, 2018

A user following the Openshift Ansible instructions was unable to use the run_once functionality. After digging into the code a bit I found that _inspect_system_branch(..) loads the manifest and assumes it will have the labels:

        labels = {}
        manifest = self._image_manifest(repo, commit_rev)
        virtual_size = None
        if manifest:
            manifest = json.loads(manifest)
            virtual_size = self._get_virtual_size(repo, manifest)
            if 'Labels' in manifest:
                labels = manifest['Labels']
            image_id = SystemContainers._get_image_id(repo, commit_rev, manifest) or image_id

However, the manifest may not have the labels. The manifest output for the openshift ansible image renders as such:

{"schemaVersion":2,"mediaType":"application/vnd.docker.distribution.manifest.v2+json","config":{"mediaType":"application/vnd.docker.container.image.v1+json","size":4335,"digest":"sha256:45abc081093b825a638ec53a19991af0612e96e099554bbdfa88b341cdfcd2e6"},"layers":[{"mediaType":"application/vnd.docker.image.rootfs.diff.tar.gzip","size":74876245,"digest":"sha256:9cadd93b16ff2a0c51ac967ea2abfadfac50cfa3af8b5bf983d89b8f8647f3e4"},{"mediaType":"application/vnd.docker.image.rootfs.diff.tar.gzip","size":1239,"digest":"sha256:4aa565ad8b7a87248163ce7dba1dd3894821aac97e846b932ff6b8ef9a8a508a"},{"mediaType":"application/vnd.docker.image.rootfs.diff.tar.gzip","size":154068365,"digest":"sha256:7952714329657fa2bb63bbd6dddf27fcf717186a9613b7fab22aeb7f7831b08a"}]}

Using skopeo inspect --raw on the image shows the information in question is stored in history[0].v1Compatibility.

Looking at self.get_manifest(..) I was hoping we could grab the data but it looks like the same issue exists there. When attempting to pull the remote manifest the labels don't come down either.

@ashcrow
Copy link
Contributor Author

ashcrow commented Feb 1, 2018

/cc @giuseppe

@giuseppe
Copy link
Collaborator

giuseppe commented Feb 1, 2018

Fixed with: #1170 @baude is cutting a new release that will contain the fix

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants