Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parsing image references with both tag and sha fails #351

Closed
martin-sucha opened this issue Jan 20, 2019 · 4 comments · Fixed by #391
Closed

Parsing image references with both tag and sha fails #351

martin-sucha opened this issue Jan 20, 2019 · 4 comments · Fixed by #391

Comments

@martin-sucha
Copy link

name.ParseReference does not handle Docker image references like ubuntu:latest@sha256:868fd30a0e47b8d8ac485df174795b5e2fe8a6c8f056cc707b232d65b8a1ab68 (which Docker supports). This causes GoogleContainerTools/kaniko#535.

This could probably be fixed by adding some logic to ParseReference or implementing #78.

@scothis
Copy link
Contributor

scothis commented Jan 31, 2019

I just bumped into this myself.

My naive attempt at a fix was to embed Tag inside Digest instead of Repository, and to test for a tag when parsing the digest. This almost works, but a few of the reflective test fail as it adds a default :latest tag to the output image name. If I can get it working I'll send a PR.

@jonjohnsonjr
Copy link
Collaborator

I'm curious what the expected semantics of this reference are. Do you pull the image by the tag and error out if the digest is different? Is the tag just there as a "comment" that we can safely ignore? I'm leaning towards the latter to avoid breaking people when tags change.

@scothis
Copy link
Contributor

scothis commented Jan 31, 2019

In my local tests with docker pull the tag is ignored. Haven't looked at the spec yet.

@briandealwis
Copy link
Contributor

I've hit this with Skaffold, which catenates an image reference (like xxx:latest) with the sha256 digest. This is then passed along in a Kubernetes manifest which is happily accepted.

      containers:
        image: gcr.io/gcp-dev-tools/bdealwis/xxx/microservices-kubernetes-demo-customer:02e6676@sha256:852935558bef6251c18c0c69c79eafa002d1e24cff3599dd499e6e33a201f58d
        name: microservices-kubernetes-demo-customer

viceice added a commit to viceice/go-containerregistry that referenced this issue Mar 5, 2019
jonjohnsonjr pushed a commit that referenced this issue Mar 5, 2019
sbawaska pushed a commit to projectriff-archive/cnab-k8s-installer-base that referenced this issue Mar 21, 2019
sbawaska pushed a commit to projectriff-archive/cnab-k8s-installer-base that referenced this issue Mar 21, 2019
Fix test to use distinct digests when necessary. Without this, tests fail non-
deterministically because some tests work with images which appear twice with
distinct tags and stripping out the tags adds duplicate keys in the resolved
image manifest (and the last one "wins") unless the images are given distinct
digests.

Move the workaround from the general image package to the image resolution
command.

Reuse reference.WithDigest and reference.TrimNamed.

Fixes https://github.com/pivotal-cf/pfs/issues/230
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants