-
Notifications
You must be signed in to change notification settings - Fork 189
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
feat(ui): visualize oci annotation #3715
Conversation
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
Signed-off-by: Mayursinh Sarvaiya <marvinduff97@gmail.com>
Signed-off-by: Mayursinh Sarvaiya <marvinduff97@gmail.com>
✅ Deploy Preview for docs-kargo-io ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3715 +/- ##
==========================================
+ Coverage 21.82% 21.90% +0.08%
==========================================
Files 312 313 +1
Lines 65571 65708 +137
==========================================
+ Hits 14311 14396 +85
- Misses 50490 50536 +46
- Partials 770 776 +6 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
@Marvin9 I test drove this with arbitrary annotation foo=bar and didn't see it come through in the UI. Looking at the code, it seems this only displays two specific, well-defined annotations. Have I got that right? If so, I am wondering if it would be better to display all the annotations that @hiddeco's changes find. @jessesuen how were you expecting this to work? |
Correct @krancour its because those are the thing that are meaningful, all other annotation you can see it from manifest. I will update at least freight details to show more raw annotation values |
Signed-off-by: Mayursinh Sarvaiya <marvinduff97@gmail.com>
@krancour would you test this again? Now it shows all OCI annotation in freight details |
Sorry for commenting late but I was in agreement with Kent in that we should be able to see all the annotations. |
I have updated UI to show all OCI in freight details. @krancour Please test now |
This is great! Would these be also eventually be accessible in the freight, e.g. be able to use them during promotions? |
@nikolay-te the |
@jessesuen, my apologies, but we need more clarification still... Is "all" really all just those with predefined keys? Currently this still will not show completely arbitrary ones like |
export const getImageSource = (annotation: Annotation) => { | ||
const url = annotation?.[ociAnnotationKeys.source]; | ||
const revision = annotation?.[ociAnnotationKeys.revision]; | ||
|
||
if (!revision) { | ||
return url; | ||
} | ||
|
||
let baseUrl; | ||
|
||
if (url.includes('github.com')) { | ||
baseUrl = url | ||
.replace(/^git@github.com:/, 'https://github.com/') | ||
.replace(/^https?:\/\/github.com\//, 'https://github.com/') | ||
.replace(/\.git$/, ''); | ||
return `${baseUrl}/commit/${revision}`; | ||
} else if (url.includes('gitlab.com')) { | ||
baseUrl = url | ||
.replace(/^git@gitlab.com:/, 'https://gitlab.com/') | ||
.replace(/^https?:\/\/gitlab.com\//, 'https://gitlab.com/') | ||
.replace(/\.git$/, ''); | ||
return `${baseUrl}/-/commit/${revision}`; | ||
} else if (url.includes('bitbucket.org')) { | ||
baseUrl = url | ||
.replace(/^git@bitbucket.org:/, 'https://bitbucket.org/') | ||
.replace(/^https?:\/\/bitbucket.org\//, 'https://bitbucket.org/') | ||
.replace(/\.git$/, ''); | ||
return `${baseUrl}/commits/${revision}`; | ||
} | ||
|
||
return url; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't better to use something similar to this? https://github.com/argoproj/argo-cd/blob/master/ui/src/app/shared/components/urls.ts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think its fine
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rename this to utils.ts or add utils as a suffix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would add suffix. I learnt from @krancour in backend that util
name is code smell and that kind of stuck to me because truly its hard to know what it contains and also hard to find the file by function name.
I meant all as in any annotation, including |
Thank you for the clarification @jessesuen! |
Signed-off-by: Mayursinh Sarvaiya <marvinduff97@gmail.com>
Signed-off-by: Mayursinh Sarvaiya <marvinduff97@gmail.com>
head from #3676