-
Notifications
You must be signed in to change notification settings - Fork 85
Update github.com/libgit2/git2go to v31.6.1 #222
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40f0679 to
84facf8
Compare
To help listing the available commands, using the same formatting as already used in `fluxcd/flux2`. Signed-off-by: Hidde Beydals <hello@hidde.co>
- Detection of the system version of `libgit2` is attempted using `pkg-config`. If this fails, or does not match the version as defined in the `Makefile` (or configured using `LIBGIT2_VER=1.x.y`), the library is compiled using the instructions from the `BASE_IMG`, and installed to `REPOSITORY_ROOT/hack/libgit2`. - Where `libgit2` is required as a dependency, `LD_LIBRARY_PATH` and/or `PKG_CONFIG_PATH` instructions are added as a prefix to the command. This works for system libraries as well, because the paths are ignored if they do not exist. Signed-off-by: Hidde Beydals <hello@hidde.co>
601fa92 to
cde8c3e
Compare
stefanprodan
approved these changes
Oct 8, 2021
cde8c3e to
ecf751b
Compare
Member
Author
|
@squaremo same as with fluxcd/source-controller#437 (comment). Do not like to overrule, but we want to get this out (with the aim to fix at least 1/2 of the transport related issues). |
This commit updates `github.com/libgit2/git2go` to `v31.6.1` (with `libgit2` `1.1.1`), and changes the container image build process so that it makes use of `ghcr.io/hiddeco/golang-with-libgit2`. This image provides a pre-build dynamic `libgit2` dependency linked against OpenSSL and LibSSH2 (without gcrypt), and a set of cross-compile build tools (see [rationale](https://github.com/hiddeco/golang-with-libgit2#rationale) and [usage](https://github.com/hiddeco/golang-with-libgit2#usage) for more detailed information). The linked set of dependency should solve most known issues around unsupport private key types, but does not resolve the issues with ECDSA* and ED25519 hostkeys yet. Solving this requires a newer version of `libgit2` (`>=1.2.0`), which currently does not seem to work properly with `git2go/v32`. Signed-off-by: Hidde Beydals <hello@hidde.co>
This moves the `libgit2` compilation to the image, to ensure it can be build on builders that aren't backed by AMD64. The image is structured in such a way that e.g. running nightly builds targeting a different Go version, or targeting a different OS vendor would be possible in the future via build arguments. Signed-off-by: Hidde Beydals <hello@hidde.co>
This ensures the Dockerfile used for testing is making use of the same scratch image to compile `libgit2` as the actual application image. In a future iteration we should restructure our GitHub Action workflows to re-use the application image, saving us an additional Dockerfile and a duplicate build. Inspiration for this (which makes use of a local registry for the duration of the build) can be found at: https://github.com/fluxcd/golang-with-libgit2/blob/main/.github/workflows/build.yaml Signed-off-by: Hidde Beydals <hello@hidde.co>
Signed-off-by: Hidde Beydals <hello@hidde.co>
This includes a tiny fix for Darwin to ensure the generated `.pc` file includes the right paths. Signed-off-by: Hidde Beydals <hello@hidde.co>
cc44869 to
f1220d1
Compare
6 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR updates
github.com/libgit2/git2gotov31.6.1(withlibgit21.1.1), and changes the container image build process so that it makes use ofghcr.io/fluxcd/golang-with-libgit2.This image provides a
Makefilewith specific build instructions to compilelibgit2in such a way that it is linked against OpenSSL and LibSSH2 (without gcrypt) (see rationale and usage for more detailed information).The linked set of dependencies should solve most known issues around unsupported private key types, but does not resolve the issues with ECDSA* and ED25519 hostkeys yet. Solving this requires a newer version of
libgit2(>=1.2.0), which currently does not seem to work properly withgit2go/v32.In addition, to support the new image and improve the contributor experience, a couple of changes have been made to the various
maketargets:libgit2is attempted usingpkg-config. If this fails, or does not match the version as defined in theMakefile(or configured usingLIBGIT2_VERSION=1.x.y), the library is compiled using the instructions from theLIBGIT2_IMG, and installed toREPOSITORY_ROOT/hack/libgit2.libgit2is required as a dependency,LD_LIBRARY_PATHand/orPKG_CONFIG_PATHinstructions are added as a prefix to the command. This works for system libraries as well, because the paths are ignored if they do not exist.docker-buildis now always making use ofdocker buildx. It allows configuration over the target platform(s) and additional build arguments usingBUILD_PLATFORMSandBUILD_ARGS.💡 using
xx, the build time for source-controller was improved from around 40 minutes to 10 minutes in total.