From 50ef51b59d3f4035942d894d17cf58ce309f0d15 Mon Sep 17 00:00:00 2001 From: Paulo Gomes Date: Fri, 2 Sep 2022 17:51:11 +0100 Subject: [PATCH 1/3] fuzz: Ensure latest base images are used Latest base image should contain Go 1.18, removing the need of updating that ourselves, apart from benefiting from latest changes upstream. Signed-off-by: Paulo Gomes --- Makefile | 2 +- tests/fuzz/Dockerfile.builder | 7 +------ 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 47b44a0a4..40f1be831 100644 --- a/Makefile +++ b/Makefile @@ -234,7 +234,7 @@ fuzz-build: $(LIBGIT2) rm -rf $(BUILD_DIR)/fuzz/ mkdir -p $(BUILD_DIR)/fuzz/out/ - docker build . --tag local-fuzzing:latest -f tests/fuzz/Dockerfile.builder + docker build . --pull --tag local-fuzzing:latest -f tests/fuzz/Dockerfile.builder docker run --rm \ -e FUZZING_LANGUAGE=go -e SANITIZER=address \ -e CIFUZZ_DEBUG='True' -e OSS_FUZZ_PROJECT_NAME=fluxcd \ diff --git a/tests/fuzz/Dockerfile.builder b/tests/fuzz/Dockerfile.builder index ad90ee08f..c98a6d819 100644 --- a/tests/fuzz/Dockerfile.builder +++ b/tests/fuzz/Dockerfile.builder @@ -1,9 +1,4 @@ -FROM golang:1.18 AS go - -FROM gcr.io/oss-fuzz-base/base-builder-go - -# ensures golang 1.18 to enable go native fuzzing. -COPY --from=go /usr/local/go /usr/local/ +FROM gcr.io/oss-fuzz-base/base-builder-go-codeintelligencetesting COPY ./ $GOPATH/src/github.com/fluxcd/source-controller/ COPY ./tests/fuzz/oss_fuzz_build.sh $SRC/build.sh From e26f8b4fc638337b35f8c0d311b417e8b929b3fd Mon Sep 17 00:00:00 2001 From: Paulo Gomes Date: Fri, 2 Sep 2022 17:51:28 +0100 Subject: [PATCH 2/3] fuzz: Reuse go cache from host Signed-off-by: Paulo Gomes --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index 40f1be831..c97866660 100644 --- a/Makefile +++ b/Makefile @@ -244,6 +244,7 @@ fuzz-build: $(LIBGIT2) fuzz-smoketest: fuzz-build docker run --rm \ -v "$(BUILD_DIR)/fuzz/out":/out \ + -v "$(shell go env GOMODCACHE):/root/go/pkg/mod" \ -v "$(shell pwd)/tests/fuzz/oss_fuzz_run.sh":/runner.sh \ local-fuzzing:latest \ bash -c "/runner.sh" From 976f4bb3fb51694c40f5ab00c64770c6668bdbd8 Mon Sep 17 00:00:00 2001 From: Paulo Gomes Date: Sat, 3 Sep 2022 03:59:03 +0100 Subject: [PATCH 3/3] fuzz: Fix cache path Signed-off-by: Paulo Gomes --- .github/workflows/cifuzz.yaml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cifuzz.yaml b/.github/workflows/cifuzz.yaml index 1e0ace738..461e3e1b6 100644 --- a/.github/workflows/cifuzz.yaml +++ b/.github/workflows/cifuzz.yaml @@ -21,12 +21,15 @@ jobs: uses: actions/setup-go@v3 with: go-version: 1.18.x + - id: go-env + run: | + echo "::set-output name=go-mod-cache::$(go env GOMODCACHE)" - name: Restore Go cache uses: actions/cache@v3 with: - path: /home/runner/work/_temp/_github_home/go/pkg/mod + path: ${{ steps.go-env.outputs.go-mod-cache }} key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} restore-keys: | - ${{ runner.os }}-go- + ${{ runner.os }}-go - name: Smoke test Fuzzers run: make fuzz-smoketest