-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #222 from fluxcd/update-libgit2
Update github.com/libgit2/git2go to v31.6.1
- Loading branch information
Showing
12 changed files
with
240 additions
and
103 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
hack/libgit2/ |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,35 @@ | ||
FROM golang:1.16-buster as builder | ||
|
||
# Up-to-date libgit2 dependencies are only available in sid (unstable). | ||
RUN echo "deb http://deb.debian.org/debian unstable main" >> /etc/apt/sources.list \ | ||
&& echo "deb-src http://deb.debian.org/debian unstable main" >> /etc/apt/sources.list | ||
RUN set -eux; \ | ||
apt-get update \ | ||
&& apt-get install -y libgit2-dev/unstable zlib1g-dev/unstable libssh2-1-dev/unstable libpcre3-dev/unstable \ | ||
&& apt-get clean \ | ||
&& apt-get autoremove --purge -y \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
ARG BASE_VARIANT=bullseye | ||
ARG GO_VERSION=1.16.8 | ||
ARG XX_VERSION=1.0.0-rc.2 | ||
|
||
ARG LIBGIT2_IMG=ghcr.io/fluxcd/golang-with-libgit2 | ||
ARG LIBGIT2_TAG=libgit2-1.1.1-1 | ||
|
||
FROM tonistiigi/xx:${XX_VERSION} AS xx | ||
FROM ${LIBGIT2_IMG}:${LIBGIT2_TAG} as libgit2 | ||
|
||
FROM golang:${GO_VERSION}-${BASE_VARIANT} as gostable | ||
|
||
# Copy the build utiltiies | ||
COPY --from=xx / / | ||
COPY --from=libgit2 /Makefile /libgit2/ | ||
|
||
# Install the libgit2 build dependencies | ||
RUN make -C /libgit2 cmake | ||
|
||
RUN make -C /libgit2 dependencies | ||
|
||
# Compile and install libgit2 | ||
RUN FLAGS=$(xx-clang --print-cmake-defines) make -C /libgit2 libgit2 | ||
|
||
# Use the GitHub Actions uid:gid combination for proper fs permissions | ||
RUN groupadd -g 116 test && \ | ||
useradd -u 1001 --gid test --shell /bin/sh --create-home test | ||
|
||
# Run as test user | ||
USER test | ||
|
||
# Set path to envtest binaries. | ||
ENV PATH="/github/workspace/envtest:${PATH}" | ||
|
||
ENTRYPOINT ["/bin/sh", "-c"] |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,3 +27,6 @@ bin | |
*.swp | ||
*.swo | ||
*~ | ||
|
||
# Exclude all libgit2 related files | ||
hack/libgit2/ |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,6 +27,40 @@ to join the conversation (this will also add an invitation to your | |
Google calendar for our [Flux | ||
meeting](https://docs.google.com/document/d/1l_M0om0qUEN_NNiGgpqJ2tvsF2iioHkaARDeh6b70B0/edit#)). | ||
|
||
### Installing required dependencies | ||
|
||
The dependency [libgit2](https://libgit2.org/) needs to be installed to be able | ||
to run source-controller or its test-suite locally (not in a container). | ||
|
||
In case this dependency is not present on your system (at the expected | ||
version), the first invocation of a `make` target that requires the | ||
dependency will attempt to compile it locally to `hack/libgit2`. For this build | ||
to succeed; CMake, OpenSSL 1.1 and LibSSH2 must be present on the system. | ||
|
||
Triggering a manual build of the dependency is possible as well by running | ||
`make libgit2`. To enforce the build, for example if your system dependencies | ||
match but are not linked in a compatible way, append `LIBGIT2_FORCE=1` to the | ||
`make` command. | ||
|
||
#### macOS | ||
|
||
```console | ||
$ # Ensure libgit2 dependencies are available | ||
$ brew install cmake [email protected] libssh2 pkg-config | ||
$ LIBGIT2_FORCE=1 make libgit2 | ||
``` | ||
|
||
#### Linux | ||
|
||
```console | ||
$ # Ensure libgit2 dependencies are available | ||
$ pacman -S cmake openssl libssh2 | ||
$ LIBGIT2_FORCE=1 make libgit2 | ||
``` | ||
|
||
**Note:** Example shown is for Arch Linux, but likewise procedure can be | ||
followed using any other package manager, e.g. `apt`. | ||
|
||
### How to run the test suite | ||
|
||
Prerequisites: | ||
|
This file contains 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
Oops, something went wrong.