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

Does not correctly tag digest pinned container image #836

Open
jetersen opened this issue Nov 11, 2024 · 1 comment
Open

Does not correctly tag digest pinned container image #836

jetersen opened this issue Nov 11, 2024 · 1 comment

Comments

@jetersen
Copy link

jetersen commented Nov 11, 2024

Given image using tag with digest pinned it does not correct upload the image with tag v2.13.0 and gets deleted by untagged images policy 😅

argo-cd:
  global:
    image:
      repository: quay.io/argoproj/argocd
      tag: v2.13.0@sha256:5806aac0c6e4d04aeeb385a218cfeaeb4daaab9bfbc2b41f908788eb5b3d2909
@jetersen
Copy link
Author

jetersen commented Nov 11, 2024

This method should properly return normalizedName, tag, digest and than if tag and digest is not nil. Tag the digest after having copied it 🤔

func imageNamesWithDigestOrTag(imageName string) (string, error) {
ref, err := reference.ParseNormalizedNamed(imageName)
if err != nil {
return "", err
}
_, isTagged := ref.(reference.NamedTagged)
canonical, isDigested := ref.(reference.Canonical)
if isTagged && isDigested {
canonical, err = reference.WithDigest(reference.TrimNamed(ref), canonical.Digest())
if err != nil {
return "", err
}
imageName = canonical.String()
}
return imageName, nil
}

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

No branches or pull requests

1 participant