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 diff --git a/Makefile b/Makefile index 47b44a0a4..c97866660 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 \ @@ -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" 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