File tree Expand file tree Collapse file tree 4 files changed +27
-7
lines changed Expand file tree Collapse file tree 4 files changed +27
-7
lines changed Original file line number Diff line number Diff line change 1- hack /libgit2 /
1+ build /libgit2 /
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ ARG GO_VERSION=1.17
33ARG XX_VERSION=1.1.0
44
55ARG LIBGIT2_IMG=ghcr.io/fluxcd/golang-with-libgit2
6- ARG LIBGIT2_TAG=libgit2-1.1.1-6
6+ ARG LIBGIT2_TAG=libgit2-1.1.1-7
77
88FROM ${LIBGIT2_IMG}:${LIBGIT2_TAG} AS libgit2-libs
99
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ TAG ?= latest
44
55# Base image used to build the Go binary
66LIBGIT2_IMG ?= ghcr.io/fluxcd/golang-with-libgit2
7- LIBGIT2_TAG ?= libgit2-1.1.1-6
7+ LIBGIT2_TAG ?= libgit2-1.1.1-7
88
99# Allows for defining additional Docker buildx arguments,
1010# e.g. '--push'.
@@ -234,13 +234,11 @@ fuzz-build: $(LIBGIT2)
234234 rm -rf $(shell pwd) /build/fuzz/
235235 mkdir -p $(shell pwd) /build/fuzz/out/
236236
237- # TODO: remove mapping of current libgit2 dir and pull binaries from release or build dependency chain on demand.
238237 docker build . --tag local-fuzzing:latest -f tests/fuzz/Dockerfile.builder
239238 docker run --rm \
240239 -e FUZZING_LANGUAGE=go -e SANITIZER=address \
241240 -e CIFUZZ_DEBUG='True' -e OSS_FUZZ_PROJECT_NAME=fluxcd \
242241 -v "$(shell pwd)/build/fuzz/out":/out \
243- -v "$(shell pwd)/build/libgit2":"/root/go/src/github.com/fluxcd/source-controller/build/libgit2" \
244242 local-fuzzing:latest
245243
246244fuzz-smoketest : fuzz-build
Original file line number Diff line number Diff line change 1616
1717set -euxo pipefail
1818
19- LIBGIT2_TAG=" ${LIBGIT2_TAG:- libgit2-1.1.1-6 } "
19+ LIBGIT2_TAG=" ${LIBGIT2_TAG:- libgit2-1.1.1-7 } "
2020GOPATH=" ${GOPATH:-/ root/ go} "
2121GO_SRC=" ${GOPATH} /src"
2222PROJECT_PATH=" github.com/fluxcd/source-controller"
@@ -25,9 +25,31 @@ cd "${GO_SRC}"
2525
2626pushd " ${PROJECT_PATH} "
2727
28+ export TARGET_DIR=" $( /bin/pwd) /build/libgit2/${LIBGIT2_TAG} "
29+
30+ # For most cases, libgit2 will already be present.
31+ # The exception being at the oss-fuzz integration.
32+ if [ ! -d " ${TARGET_DIR} " ]; then
33+ curl -o output.tar.gz -LO " https://github.com/fluxcd/golang-with-libgit2/releases/download/${LIBGIT2_TAG} /linux-$( uname -m) -libs.tar.gz"
34+
35+ DIR=libgit2-linux
36+ NEW_DIR=" $( /bin/pwd) /build/libgit2/${LIBGIT2_TAG} "
37+ INSTALLED_DIR=" /home/runner/work/golang-with-libgit2/golang-with-libgit2/build/${DIR} "
38+
39+ mkdir -p ./build/libgit2
40+
41+ tar -xf output.tar.gz
42+ rm output.tar.gz
43+ mv " ${DIR} " " ${LIBGIT2_TAG} "
44+ mv " ${LIBGIT2_TAG} /" " ./build/libgit2"
45+
46+ # Update the prefix paths included in the .pc files.
47+ # This will make it easier to update to the location in which they will be used.
48+ find " ${NEW_DIR} " -type f -name " *.pc" | xargs -I {} sed -i " s;${INSTALLED_DIR} ;${NEW_DIR} ;g" {}
49+ fi
50+
2851apt-get update && apt-get install -y pkg-config
2952
30- export TARGET_DIR=" $( /bin/pwd) /build/libgit2/${LIBGIT2_TAG} "
3153export CGO_ENABLED=1
3254export LIBRARY_PATH=" ${TARGET_DIR} /lib:${TARGET_DIR} /lib64"
3355export PKG_CONFIG_PATH=" ${TARGET_DIR} /lib/pkgconfig:${TARGET_DIR} /lib64/pkgconfig"
You can’t perform that action at this time.
0 commit comments