jkube
jkube copied to clipboard
ImageName should be able to handle Image names when both tag and digest are provided
Component
None
Task description
Description
As described in this comment in ORAS registry/reference.go:
<--- path --------------------------------------------> | - Decode
path<=== REPOSITORY ===> <--- reference ------------------> | - Decodereference<=== REPOSITORY ===> @ <=================== digest ===> | - Valid Form A <=== REPOSITORY ===> : <!!! TAG !!!> @ <=== digest ===> | - Valid Form B (tag is dropped) <=== REPOSITORY ===> : <=== TAG ======================> | - Valid Form C <=== REPOSITORY ======================================> | - Valid Form D
When both tag and digest are provided, the tag should be ignored and digest should be used. Currently, ImageName is not able to handle this scenario and throws an exception.
Expected Behavior
ImageName should be able to handle ImageName with both tag and digest (e.g. registry.example.com/hello-world:@sha256:b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9) provided and give precedence to digest.
Acceptance Criteria
- [ ] ImageName is updated to handle scenarios including both tag and digest
Hi @rohanKanojia i have a doubt, is IMAGE_NAME_REGEXP = Pattern.compile(NAME_COMPONENT_REGEXP + "(?:(?:/" + NAME_COMPONENT_REGEXP + ")+)?"); correct? because i can see an extra component "domainregexp" in its reference
https://github.com/docker/docker/blob/04da4041757370fb6f85510c8977c5a18ddae380/vendor/github.com/docker/distribution/reference/regexp.go#L53
NameRegexp = expression(
optional(DomainRegexp, literal(/)),
nameComponentRegexp,
optional(repeated(literal(/), nameComponentRegexp)))
@Devashishbasu : I think this regex only validates the name portion. Could you please check it by setting a breakpoint in doValidate() method and checking if image actually contains registry at during validation. I think registry is already extracted from image name before reaching this path.
@Devashishbasu : I think this regex only validates the name portion. Could you please check it by setting a breakpoint in
doValidate()method and checking ifimageactually contains registry at during validation. I think registry is already extracted from image name before reaching this path.
yes you are right , registry is already extracted from image name before reaching this path.