-
Notifications
You must be signed in to change notification settings - Fork 38
fix(cli attestation): handle non-merged branches #451
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
Conversation
Signed-off-by: Miguel Martinez Trivino <miguel@chainloop.dev>
return nil, fmt.Errorf("getting remotes: %w", err) | ||
// go-git does an additional validation that the branch is pushed upstream | ||
// we do not care about that use-case, so we ignore the error | ||
return c, nil |
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 know this is swallowing other errors, but I decided to go this way since
- That error type is not exposed in the upstream library
- We really shouldn't block on remotes lookups for any reason.
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 understand the point, but I can see that the function repo.Remotes()
can return more than one type of error. I think you want to swallow only if err is ErrRemoteNotFound
or equivalent, am I right?
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.
That's right, that's what I tried to explain in my comment. "I know this is swallowing other errors"
I just thought it was not worth inspecting them as long as we log them (see the logger.Warn), and I do not see a reason why we should fail in any circumstance.
In any case, let me revisit it.
Thanks!
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.
Ok so you are ubersure that no matter what happens, we can keep going.
Gotcha, I'll approve now that I'm sure <3
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.
ptal at the change now.
Signed-off-by: Miguel Martinez Trivino <miguel@chainloop.dev>
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'm requesting changes just to make sure my question is answered.
Signed-off-by: Miguel Martinez Trivino <miguel@chainloop.dev>
Signed-off-by: Miguel Martinez Trivino <miguel@chainloop.dev>
Shows an error message instead of blocking the attestation