Skip to content

Conversation

migmartri
Copy link
Member

@migmartri migmartri commented Dec 1, 2023

Shows an error message instead of blocking the attestation

WRN failed to list remotes error="branch config: invalid merge"

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
Copy link
Member Author

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.

Copy link
Contributor

@buccarel buccarel Dec 1, 2023

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?

Copy link
Member Author

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!

Copy link
Contributor

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

Copy link
Member Author

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>
Copy link
Contributor

@buccarel buccarel left a 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>
@migmartri migmartri merged commit ab80861 into chainloop-dev:main Dec 1, 2023
@migmartri migmartri deleted the fix-upstream-remotes branch December 1, 2023 11:09
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.

2 participants