Skip to content

Commit 010893b

Browse files
authored
Merge pull request #228 from fluxcd/libgit2-from-src
2 parents 2dd7772 + 38e2e58 commit 010893b

File tree

3 files changed

+22
-3
lines changed

3 files changed

+22
-3
lines changed

.github/actions/run-tests/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ FROM golang:1.15-alpine
22

33
# Add any build or testing essential system packages
44
RUN apk add --no-cache build-base git pkgconf
5-
RUN apk add --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/edge/community libgit2-dev=1.1.0-r1
5+
RUN apk add --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/edge/community libgit2-dev~=1.1.0
66

77
# Use the GitHub Actions uid:gid combination for proper fs permissions
88
RUN addgroup -g 116 -S test && adduser -u 1001 -S -g test test

CONTRIBUTING.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,25 @@ brew install libgit2
4343
pacman -S libgit2
4444
```
4545

46+
**Building from source**
47+
48+
1. Ensure [`cmake`](https://cmake.org) is available on your system.
49+
1. Download and unarchive [the right `libgit2` version](https://github.com/libgit2/git2go#which-go-version-to-use)
50+
for our current `git2go` dependency:
51+
52+
```console
53+
$ LIBGIT2_VER=1.1.0
54+
$ curl -L https://github.com/libgit2/libgit2/releases/download/v$LIBGIT2_VER/libgit2-$LIBGIT2_VER.tar.gz -o /tmp/libgit2.tar.gz
55+
$ tar -xvf /tmp/libgit2.tar.gz -C /tmp/libgit2-$LIBGIT2_VER
56+
```
57+
1. Build and install the library on your system:
58+
59+
```console
60+
$ mkdir /tmp/libgit2-$LIBGIT2_VER/build && cd /tmp/libgit2-$LIBGIT2_VER/build
61+
$ cmake .. -DCMAKE_INSTALL_PREFIX=/usr
62+
$ sudo cmake --build . --target install
63+
```
64+
4665
### How to run the test suite
4766

4867
You can run the unit tests by simply doing

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
FROM golang:1.15-alpine as builder
33

44
RUN apk add gcc pkgconfig libc-dev
5-
RUN apk add --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/edge/community libgit2-dev=1.1.0-r1
5+
RUN apk add --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/edge/community libgit2-dev~=1.1.0
66

77
WORKDIR /workspace
88

@@ -31,7 +31,7 @@ FROM alpine:3.12
3131
LABEL org.opencontainers.image.source="https://github.com/fluxcd/source-controller"
3232

3333
RUN apk add --no-cache ca-certificates tini
34-
RUN apk add --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/edge/community libgit2=1.1.0-r1
34+
RUN apk add --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/edge/community libgit2-dev~=1.1.0
3535

3636
COPY --from=builder /workspace/source-controller /usr/local/bin/
3737

0 commit comments

Comments
 (0)