From 88c76c50a3c85a5beac7c9da29716e1e7c1505bc Mon Sep 17 00:00:00 2001 From: Hidde Beydals Date: Wed, 9 Dec 2020 16:49:28 +0100 Subject: [PATCH 1/2] Document how to build libgit2 from source Signed-off-by: Hidde Beydals --- CONTRIBUTING.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d03f0bf7..29ce578b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -43,6 +43,25 @@ brew install libgit2 pacman -S libgit2 ``` +**Building from source** + +1. Ensure [`cmake`](https://cmake.org) is available on your system. +1. Download and unarchive [the right `libgit2` version](https://github.com/libgit2/git2go#which-go-version-to-use) + for our current `git2go` dependency: + + ```console + $ LIBGIT2_VER=1.1.0 + $ curl -L https://github.com/libgit2/libgit2/releases/download/v$LIBGIT2_VER/libgit2-$LIBGIT2_VER.tar.gz -o /tmp/libgit2.tar.gz + $ tar -xvf /tmp/libgit2.tar.gz -C /tmp/libgit2-$LIBGIT2_VER + ``` +1. Build and install the library on your system: + + ```console + $ mkdir /tmp/libgit2-$LIBGIT2_VER/build && cd /tmp/libgit2-$LIBGIT2_VER/build + $ cmake .. -DCMAKE_INSTALL_PREFIX=/usr + $ sudo cmake --build . --target install + ``` + ### How to run the test suite You can run the unit tests by simply doing From 38e2e58c545f3660156e82521fe942460db029b8 Mon Sep 17 00:00:00 2001 From: Hidde Beydals Date: Wed, 9 Dec 2020 16:55:24 +0100 Subject: [PATCH 2/2] Use semver tidle range for `libgit2-dev` package Signed-off-by: Hidde Beydals --- .github/actions/run-tests/Dockerfile | 2 +- Dockerfile | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/actions/run-tests/Dockerfile b/.github/actions/run-tests/Dockerfile index c096a0b9..e5f1c131 100644 --- a/.github/actions/run-tests/Dockerfile +++ b/.github/actions/run-tests/Dockerfile @@ -2,7 +2,7 @@ FROM golang:1.15-alpine # Add any build or testing essential system packages RUN apk add --no-cache build-base git pkgconf -RUN apk add --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/edge/community libgit2-dev=1.1.0-r1 +RUN apk add --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/edge/community libgit2-dev~=1.1.0 # Use the GitHub Actions uid:gid combination for proper fs permissions RUN addgroup -g 116 -S test && adduser -u 1001 -S -g test test diff --git a/Dockerfile b/Dockerfile index 287048e6..93c8c112 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ FROM golang:1.15-alpine as builder RUN apk add gcc pkgconfig libc-dev -RUN apk add --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/edge/community libgit2-dev=1.1.0-r1 +RUN apk add --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/edge/community libgit2-dev~=1.1.0 WORKDIR /workspace @@ -31,7 +31,7 @@ FROM alpine:3.12 LABEL org.opencontainers.image.source="https://github.com/fluxcd/source-controller" RUN apk add --no-cache ca-certificates tini -RUN apk add --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/edge/community libgit2=1.1.0-r1 +RUN apk add --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/edge/community libgit2-dev~=1.1.0 COPY --from=builder /workspace/source-controller /usr/local/bin/