concourse / registry-image-resource

a resource for images in a Docker registry
Apache License 2.0
89 stars 107 forks source link

Fix semver first image push #291

Closed pn-santos closed 3 years ago

pn-santos commented 3 years ago

Fixes https://github.com/concourse/registry-image-resource/issues/281

There's a couple of things I'm not too sure about:

  1. Should the code just check for 404 status code and ignore the response content? I chose to also parse the content to attempt to distinguish between a 404 due to a request not hitting the registry and a 404 due to an image not existing.

  2. I tried to come up with a test that would "fit" the existing structure, it works but if there's a "nicer" way to go about I welcome any suggestion

  3. The reason I'm parsing the NAME_UNKNOWN and NOT_FOUND is because the first one is what https://github.com/distribution/distribution returns and the second one is what https://github.com/goharbor/harbor returns (so I think this might vary between registry implementations?)

note: Not a go dev so code-wise YMMV (but I think it's mostly ok?)

pn-santos commented 3 years ago

@xtremerui I don't want to be too annoying but any chance this could be looked at soon-ish? It's a somewhat annoying issue for new images and (I hope) fairly straightforward fix (putting aside minor implementation details I listed in the OP)

xtremerui commented 3 years ago

Sorry I somehow missed the notification of reviewing this PR. Thx for the reminder.

Please feel free to pin the assignee if the PR got assigned and being no activity for at most 2 weeks.