Skip to content

ggcr: Parsing image name with both tag and digest loses tag info #2069

Open
@halamix2

Description

@halamix2

Describe the bug

When parsing image in repo.com/image:tag@sha256:f8ecdcd87d7d84b87e645074084dd7f57dd62c76e120bb21e5abde158755be56format it gets parsed as a Digest type, which returns digest from the ref.Identifier() function, and doesn't provide easy access to the tag information

I'm only using the name parsing, so I have no idea if this would have any negative impact on any other part of the library

To Reproduce

ref, _ := name.ParseReference(repo.com/image:tag@sha256:f8ecdcd87d7d84b87e645074084dd7f57dd62c76e120bb21e5abde158755be56")
fmt.Println(ref.Identifier()) // sha256:f8ecdcd87d7d84b87e645074084dd7f57dd62c76e120bb21e5abde158755be56
// fmt.Println(ref.Tag()) - doesn't exist

Expected behavior

I'd expect to have a ref.Tag() function in the Reference interface that can return image tag for both Tag and Digest structs, so that the tag name is always accessible

Additional context

  • go-containerregistry v0.20.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions