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

Resolve SHA256 to tags automatically if the images specified in the k8s manifests doesn't contain tag. #70

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

Conversation

jahantech
Copy link

We currently have a case where the images are resolved to sha256 digest before being added to the manifest. Which means it becomes impossible for us to resolve them back to tags with the current functionality of the version checker. These changes allow the resolution of tags from sha256 in the image field.

@jetstack-bot
Copy link
Contributor

@jahantech: Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@jetstack-bot
Copy link
Contributor

Hi @jahantech. Thanks for your PR.

I'm waiting for a jetstack member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

jahan added 3 commits January 4, 2021 15:58
Signed-off-by: Jahan Syed <jahansyed@hotmail.co.uk>
Signed-off-by: Jahan Syed <jahansyed@hotmail.co.uk>
Signed-off-by: Jahan Syed <jahansyed@hotmail.co.uk>
jahan added 2 commits January 4, 2021 16:02
Signed-off-by: Jahan Syed <jahansyed@hotmail.co.uk>
Signed-off-by: Jahan Syed <jahansyed@hotmail.co.uk>
@jahantech
Copy link
Author

Any update on this please if this feature is acceptable? thank you

@JoshVanL
Copy link
Contributor

Hmm, the problem with this is that multiple tags can be assigned to the same sha. In this current implementation we are just taking the first we come across. This can be wrong most of the time.

imageURL = *opts.OverrideURL
}
resolvedTag, err := c.search.ResolveSHAToTag(ctx, imageURL, currentSHA)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we not be doing something with the error here? At least logging it?


tag, err := s.versionGetter.ResolveSHAToTag(ctx, imageURL, imageSHA)
if err != nil {
fmt.Println("failed to resolve the sha " + err.Error())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We never use ‘fmt.Printf’, and instead use a loft which maintains context.

I don’t think a log here is necessary anyway.

tag, err := s.versionGetter.ResolveSHAToTag(ctx, imageURL, imageSHA)
if err != nil {
fmt.Println("failed to resolve the sha " + err.Error())
return "", fmt.Errorf("failed to resolve sha to tag")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Include err

Copy link
Contributor

@JoshVanL JoshVanL left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some comments from me. The approach makes sense to me!

@jetstack-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: jahantech
To complete the pull request process, please assign joshvanl after the PR has been reviewed.
You can assign the PR to them by writing /assign @joshvanl in a comment when ready.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@davidcollom davidcollom added this to the v1 release milestone May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants