From 121666e56f4a0cb364a6856871e1bea5ba84f2c0 Mon Sep 17 00:00:00 2001 From: Kateryna Nezdolii Date: Mon, 6 Jul 2026 14:14:00 +0000 Subject: [PATCH] ci: add ASAN integration test job Running the existing integration tests under AddressSanitizer and UndefinedBehaviorSanitizer gives the project a targeted signal for use-after-free, buffer overflows, invalid lifetime assumptions, and undefined behavior in exercised proxy code paths. The ASAN job reuses the Dockerfile.tests flow with reduced parallelism and longer timeouts to keep sanitizer output readable. The job passes the sanitizer Bazel configs explicitly so the check stays scoped to the Cilium proxy CI path. Signed-off-by: Kateryna Nezdolii --- .github/workflows/ci-tests.yaml | 50 +++++++++++++++++++++++++++++++++ Makefile | 7 +++++ 2 files changed, 57 insertions(+) diff --git a/.github/workflows/ci-tests.yaml b/.github/workflows/ci-tests.yaml index a3f4a5c6b..220875f7e 100644 --- a/.github/workflows/ci-tests.yaml +++ b/.github/workflows/ci-tests.yaml @@ -83,3 +83,53 @@ jobs: BAZEL_TEST_OPTS=--jobs=HOST_RAM*.0002 --test_timeout=300 --local_test_jobs=4 --flaky_test_attempts=3 cache-from: type=local,src=/tmp/buildx-cache push: false + + asan-tests: + timeout-minutes: 360 + name: Run ASAN integration tests on amd64 + runs-on: ${{ vars.PROXY_BUILD_GITHUB_RUNNER || 'oracle-vm-32cpu-128gb-x86-64' }} + steps: + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4.1.0 + + - name: Cache Docker layers + uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 + with: + path: /tmp/buildx-cache + key: docker-cache-tests-asan + restore-keys: docker-cache-tests + + - name: Checkout PR Source Code + uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 + with: + ref: ${{ github.event.pull_request.head.sha }} + persist-credentials: false + + - name: Prep for build + run: | + echo "${{ github.event.pull_request.head.sha }}" >SOURCE_VERSION + echo "BUILDER_DOCKER_HASH=$(git ls-tree --full-tree HEAD -- ./Dockerfile.builder | awk '{ print $3 }')" >> $GITHUB_ENV + + - name: Wait for build image + uses: ./.github/workflows/wait-for-image + with: + SHA: ${{ env.BUILDER_DOCKER_HASH }} + repo: cilium + images: cilium-envoy-builder-dev + + - name: Run ASAN integration tests on amd64 + uses: docker/build-push-action@f9f3042f7e2789586610d6e8b85c8f03e5195baf # v7.2.0 + id: docker_asan_tests_ci + with: + provenance: false + context: . + file: ./Dockerfile.tests + platforms: linux/amd64 + build-args: | + BUILDER_BASE=quay.io/${{ github.repository_owner }}/cilium-envoy-builder-dev:${{ env.BUILDER_DOCKER_HASH }} + ARCHIVE_IMAGE=quay.io/${{ github.repository_owner }}/cilium-envoy-builder:test-main-archive-latest + DEBUG=1 + BAZEL_BUILD_OPTS=--remote_upload_local_results=false --config=asan --config=clang-asan + BAZEL_TEST_OPTS=--jobs=HOST_RAM*.0001 --test_timeout=600 --local_test_jobs=2 --flaky_test_attempts=1 + cache-from: type=local,src=/tmp/buildx-cache + push: false diff --git a/Makefile b/Makefile index c5f02509d..0ad6968a2 100644 --- a/Makefile +++ b/Makefile @@ -54,6 +54,9 @@ endif # Extra opts are passed to docker targets, which will choose the bazel platform themselves EXTRA_BAZEL_BUILD_OPTS := $(BAZEL_BUILD_OPTS) +BAZEL_ASAN_BUILD_OPTS ?= $(EXTRA_BAZEL_BUILD_OPTS) -c dbg --config=asan --config=clang-asan +BAZEL_ASAN_TEST_OPTS ?= --jobs=HOST_RAM*.0001 --test_timeout=600 --local_test_jobs=2 --flaky_test_attempts=1 --test_output=errors + ifdef DEBUG BAZEL_BUILD_OPTS += -c dbg else ifdef RELEASE_DEBUG @@ -202,6 +205,10 @@ envoy-tests: $(COMPILER_DEP) SOURCE_VERSION proxylib/libcilium.so # didn't break anything $(BAZEL) $(BAZEL_OPTS) test $(BAZEL_BUILD_OPTS) $(BAZEL_TEST_OPTS) //tests/... @envoy//test/integration:tcp_proxy_integration_test $(BAZEL_FILTER) +.PHONY: envoy-asan-tests +envoy-asan-tests: + $(MAKE) envoy-tests BAZEL_BUILD_OPTS="$(BAZEL_ASAN_BUILD_OPTS)" BAZEL_TEST_OPTS="$(BAZEL_ASAN_TEST_OPTS)" + .PHONY: \ install \ force \