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

fix(decoder): ensure tag in harbor decoder #46

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

bluebrown
Copy link
Owner

resolve: #44

@bluebrown bluebrown force-pushed the fix/harbor-decoder branch from 2367d7b to 3f5060c Compare April 14, 2024 18:57
Signed-off-by: Nico Braun <rainbowstack@gmail.com>
@bluebrown bluebrown force-pushed the fix/harbor-decoder branch from 3f5060c to 6cb5b1e Compare April 14, 2024 20:24
Signed-off-by: Nico Braun <rainbowstack@gmail.com>
@bluebrown
Copy link
Owner Author

bluebrown commented Apr 14, 2024

Well, I added test and fixed the decoder as good as possible. If this is even required. Because opon even closer inspection, I see that the event shown here https://goharbor.io/docs/main/working-with-projects/project-configuration/configure-webhooks/, contains invalid data. They have a digest in the tag part, which is invalid according to RFC. It cant be parsed like that.

 "resources": [
      {
        "digest": "sha256:954b378c375d852eb3c63ab88978f640b4348b01c1b3456a024a81536dafbbf4",
        "tag": "sha256:954b378c375d852eb3c63ab88978f640b4348b01c1b3456a024a81536dafbbf4",
        "resource_url": "localhost/harbor/alpine@sha256:954b378c375d852eb3c63ab88978f640b4348b01c1b3456a024a81536dafbbf4"
      }
    ],

So either they have a typo on their docs, or this is broken.

decoder_test.go:78: failed to parse image ref: invalid tag: 
repository can only contain the characters `abcdefghijklmnopqrstuvwxyz0123456789_-./`:
localhost/harbor/alpine:sha256

Or they do this when no tag was pushed aka latest. This would require special logic in the decoder.

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 this pull request may close these issues.

Handle webhooks from Harbor container repo
1 participant