brigadecore / brigade

Event-driven scripting for Kubernetes
https://brigade.sh/
Apache License 2.0
2.4k stars 247 forks source link

Revert "re-implement git-initializer component using git2go (#1939)" #1950

Closed krancour closed 2 years ago

krancour commented 2 years ago

Further testing of the new implementation in our dogfood cluster revealed a big gotcha.

repo.LookupCommit(<sha>) only works for commits that have been fetched already. Loose commits aren't offered up by the server during the initial fetch. This means that looking up a commit by sha only works for cases wherein some branch or tag has that commit in its history. (And this is what our integration tests happen to cover when testing checking out by sha.)

This is pretty damning limitation because the overwhelming majority of our own events originate from GitHub pull requests and they reference specific commits by sha.

The correct fix for this is to craft a custom refspec for the fetch and that will allow us to retrieve any commit from the remote -- and indeed the old implementation was doing this. The trouble is that only libgit2's very latest version supports fetching using refspecs that contain a sha and git2go does not yet support the latest version of libgit2.

I haven't exhausted all options yet for fixing this, but every single thing that might work is a rabbit hole unto itself. In light of that, I'd like to roll back #1939 to restore the tip of the main branch to good working order sooner rather than later.

cc @emilwangaa

netlify[bot] commented 2 years ago

Deploy Preview for brigade-docs ready!

Name Link
Latest commit f3898228c8c342cddd28808ae4a05271465a4b74
Latest deploy log https://app.netlify.com/sites/brigade-docs/deploys/62752dabf047630008d56627
Deploy Preview https://deploy-preview-1950--brigade-docs.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

netlify[bot] commented 2 years ago

Deploy Preview for brigade-docs ready!

Name Link
Latest commit f0bc935d15cd9090316471a90d291230cf2dd19b
Latest deploy log https://app.netlify.com/sites/brigade-docs/deploys/62752ddd6260f100086afe38
Deploy Preview https://deploy-preview-1950--brigade-docs.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.