From de82dedde4394f6102899fbb3955db5f0ee41dba Mon Sep 17 00:00:00 2001 From: Edouard Schweisguth Date: Wed, 11 Feb 2026 18:55:05 +0100 Subject: [PATCH 01/13] Testing circle-ci migration to github action --- .github/workflows/ci.yml | 205 +++++++++++++++++++++++++++++++++++++++ Makefile | 6 +- 2 files changed, 209 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 000000000..3b480e29c --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,205 @@ +name: CI + +on: + pull_request: + push: + branches: [main] + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +env: + GO_VERSION: '1.25.6' + +jobs: + lint-and-format: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0 + with: + go-version: ${{ env.GO_VERSION }} + - name: Cache Go tools + uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 + with: + path: ~/go/bin + key: go-tools-lint-${{ runner.os }}-golangci-lint-2.8.0 + - name: Format + run: | + make fmt + git diff --exit-code + - name: Vet + run: make vet + - name: Lint + run: make lint + + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0 + with: + go-version: ${{ env.GO_VERSION }} + - name: Cache Go tools + uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 + with: + path: ~/go/bin + key: go-tools-test-${{ runner.os }}-controller-gen-v0.19.0-yamlfmt-0.9.0-kubebuilder-datadog-ci + - name: Install tools + run: make -j4 install-controller-gen install-yamlfmt install-kubebuilder install-datadog-ci + - name: Run unit tests + run: make test + env: + DATADOG_API_KEY: ${{ secrets.DATADOG_API_KEY }} + - name: Upload test report + if: always() + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 + with: + name: report-test.xml + path: report-test.xml + + docker-build: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + target: [injector, manager, handler] + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3.10.0 + - name: Build ${{ matrix.target }} + run: make docker-build-${{ matrix.target }} SKIP_GENERATE=true + - name: Upload tarball + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 + with: + name: docker-${{ matrix.target }} + path: bin/${{ matrix.target }}/${{ matrix.target }}.tar.gz + retention-days: 1 + + e2e-test: + runs-on: ubuntu-latest + needs: docker-build + timeout-minutes: 45 + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0 + with: + go-version: ${{ env.GO_VERSION }} + - name: Cache Go tools + uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 + with: + path: ~/go/bin + key: go-tools-e2e-${{ runner.os }}-controller-gen-v0.19.0-yamlfmt-0.9.0-helm-v3.19.0-kubebuilder-datadog-ci + - name: Install tools + run: make -j6 install-controller-gen install-yamlfmt install-helm install-kubebuilder install-datadog-ci + - name: Download docker tarballs + uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 + with: + pattern: docker-* + merge-multiple: false + - name: Move tarballs into place + run: | + for target in injector manager handler; do + mkdir -p bin/${target} + mv docker-${target}/${target}.tar.gz bin/${target}/ + done + - name: Install Minikube + run: make ci-install-minikube MINIKUBE_CPUS=max MINIKUBE_MEMORY=max + - name: Install cert-manager + run: make lima-install-cert-manager KUBECTL="minikube kubectl --" + - name: Load images into Minikube + run: make minikube-load-all + - name: Run e2e tests + uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3.0.2 + with: + timeout_minutes: 30 + max_attempts: 3 + command: make e2e-test KUBECTL="minikube kubectl --" E2E_TEST_CLUSTER_NAME="minikube" E2E_TEST_KUBECTL_CONTEXT="minikube" + env: + DATADOG_API_KEY: ${{ secrets.DATADOG_API_KEY }} + - name: Save controller logs + if: failure() + run: | + mkdir -p /tmp/logs + minikube kubectl -- -n chaos-engineering logs -lapp=chaos-controller -c manager --tail=-1 > /tmp/logs/e2e.txt 2>&1 || true + - name: Upload controller logs + if: failure() + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 + with: + name: e2e-controller-logs + path: /tmp/logs + - name: Upload e2e test report + if: always() + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 + with: + name: report-e2e-test.xml + path: report-e2e-test.xml + + validate-codegen: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0 + with: + go-version: ${{ env.GO_VERSION }} + - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 + with: + python-version: '3.12' + - name: Cache Go tools + uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 + with: + path: ~/go/bin + key: go-tools-codegen-${{ runner.os }}-controller-gen-v0.19.0-yamlfmt-0.9.0-mockery-2.53.5-protoc-3.17.3 + - name: Install tools + run: make -j6 install-controller-gen install-yamlfmt install-mockery install-protobuf PROTOC_OS=linux + - name: Validate go dependencies + run: | + make godeps + git diff --exit-code + - name: Validate manifests + run: | + make manifests + git diff --exit-code + - name: Validate mocks + run: | + make generate-mocks + git diff --exit-code + - name: Validate disruptionlistener protobuf + run: | + make generate-disruptionlistener-protobuf + git diff --exit-code ':!go.*' + - name: Validate chaosdogfood protobuf + run: | + make generate-chaosdogfood-protobuf + git diff --exit-code ':!go.*' + + python-checks: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 + with: + python-version: '3.12' + - name: Install Python dependencies + run: pip install -r tasks/requirements.txt + - name: Check third-party licenses + run: | + inv license-check + git diff --exit-code + - name: Check license headers + run: | + inv header-check + git diff --exit-code + + doc-spellcheck: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 + with: + node-version: '20' + - name: Install markdown-spellcheck + run: npm install -g markdown-spellcheck + - name: Spellcheck + run: mdspell --report --en-us --ignore-numbers --ignore-acronyms $(find . -name vendor -prune -o -name '*.md' -print) || echo "please run 'make spellcheck' for local testing" diff --git a/Makefile b/Makefile index a8eb3d66c..cab401950 100644 --- a/Makefile +++ b/Makefile @@ -224,11 +224,13 @@ spellcheck-format-spelling: sort < .spelling | sort | uniq | grep -v '^-' | tee .spelling.tmp > /dev/null && mv .spelling.tmp .spelling ## This target is dedicated for CI and aims to reuse the Kubernetes version defined here as the source of truth +MINIKUBE_CPUS ?= 6 +MINIKUBE_MEMORY ?= 28672 + ci-install-minikube: curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube_latest_amd64.deb sudo dpkg -i minikube_latest_amd64.deb -# adapt here according to circleCI VM resource_class https://circleci.com/docs/configuration-reference/#linuxvm-execution-environment - minikube start --cpus='6' --memory='28672' --vm-driver=docker --container-runtime=containerd --kubernetes-version=${KUBERNETES_VERSION} + minikube start --cpus='$(MINIKUBE_CPUS)' --memory='$(MINIKUBE_MEMORY)' --vm-driver=docker --container-runtime=containerd --kubernetes-version=${KUBERNETES_VERSION} minikube status SKIP_DEPLOY ?= From de424f02c96621500169ee37f4c00b2466c5fd1c Mon Sep 17 00:00:00 2001 From: Edouard Schweisguth Date: Wed, 11 Feb 2026 19:06:10 +0100 Subject: [PATCH 02/13] Use allowed actions --- .github/workflows/ci.yml | 77 ++++++++++++++-------------------------- 1 file changed, 26 insertions(+), 51 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3b480e29c..90c2e3d9d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,15 +16,10 @@ jobs: lint-and-format: runs-on: ubuntu-latest steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0 + - uses: actions/checkout@v2 + - uses: actions/setup-go@v5 with: go-version: ${{ env.GO_VERSION }} - - name: Cache Go tools - uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 - with: - path: ~/go/bin - key: go-tools-lint-${{ runner.os }}-golangci-lint-2.8.0 - name: Format run: | make fmt @@ -37,15 +32,10 @@ jobs: test: runs-on: ubuntu-latest steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0 + - uses: actions/checkout@v2 + - uses: actions/setup-go@v5 with: go-version: ${{ env.GO_VERSION }} - - name: Cache Go tools - uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 - with: - path: ~/go/bin - key: go-tools-test-${{ runner.os }}-controller-gen-v0.19.0-yamlfmt-0.9.0-kubebuilder-datadog-ci - name: Install tools run: make -j4 install-controller-gen install-yamlfmt install-kubebuilder install-datadog-ci - name: Run unit tests @@ -54,7 +44,7 @@ jobs: DATADOG_API_KEY: ${{ secrets.DATADOG_API_KEY }} - name: Upload test report if: always() - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 + uses: actions/upload-artifact@v4 with: name: report-test.xml path: report-test.xml @@ -66,12 +56,11 @@ jobs: matrix: target: [injector, manager, handler] steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3.10.0 + - uses: actions/checkout@v2 - name: Build ${{ matrix.target }} run: make docker-build-${{ matrix.target }} SKIP_GENERATE=true - name: Upload tarball - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 + uses: actions/upload-artifact@v4 with: name: docker-${{ matrix.target }} path: bin/${{ matrix.target }}/${{ matrix.target }}.tar.gz @@ -82,19 +71,14 @@ jobs: needs: docker-build timeout-minutes: 45 steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0 + - uses: actions/checkout@v2 + - uses: actions/setup-go@v5 with: go-version: ${{ env.GO_VERSION }} - - name: Cache Go tools - uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 - with: - path: ~/go/bin - key: go-tools-e2e-${{ runner.os }}-controller-gen-v0.19.0-yamlfmt-0.9.0-helm-v3.19.0-kubebuilder-datadog-ci - name: Install tools run: make -j6 install-controller-gen install-yamlfmt install-helm install-kubebuilder install-datadog-ci - name: Download docker tarballs - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 + uses: actions/download-artifact@v4 with: pattern: docker-* merge-multiple: false @@ -111,13 +95,18 @@ jobs: - name: Load images into Minikube run: make minikube-load-all - name: Run e2e tests - uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3.0.2 - with: - timeout_minutes: 30 - max_attempts: 3 - command: make e2e-test KUBECTL="minikube kubectl --" E2E_TEST_CLUSTER_NAME="minikube" E2E_TEST_KUBECTL_CONTEXT="minikube" env: DATADOG_API_KEY: ${{ secrets.DATADOG_API_KEY }} + run: | + for attempt in 1 2 3; do + echo "=== Attempt ${attempt}/3 ===" + if make e2e-test KUBECTL="minikube kubectl --" E2E_TEST_CLUSTER_NAME="minikube" E2E_TEST_KUBECTL_CONTEXT="minikube"; then + exit 0 + fi + echo "Attempt ${attempt} failed" + done + echo "All 3 attempts failed" + exit 1 - name: Save controller logs if: failure() run: | @@ -125,13 +114,13 @@ jobs: minikube kubectl -- -n chaos-engineering logs -lapp=chaos-controller -c manager --tail=-1 > /tmp/logs/e2e.txt 2>&1 || true - name: Upload controller logs if: failure() - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 + uses: actions/upload-artifact@v4 with: name: e2e-controller-logs path: /tmp/logs - name: Upload e2e test report if: always() - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 + uses: actions/upload-artifact@v4 with: name: report-e2e-test.xml path: report-e2e-test.xml @@ -139,18 +128,10 @@ jobs: validate-codegen: runs-on: ubuntu-latest steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0 + - uses: actions/checkout@v2 + - uses: actions/setup-go@v5 with: go-version: ${{ env.GO_VERSION }} - - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 - with: - python-version: '3.12' - - name: Cache Go tools - uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 - with: - path: ~/go/bin - key: go-tools-codegen-${{ runner.os }}-controller-gen-v0.19.0-yamlfmt-0.9.0-mockery-2.53.5-protoc-3.17.3 - name: Install tools run: make -j6 install-controller-gen install-yamlfmt install-mockery install-protobuf PROTOC_OS=linux - name: Validate go dependencies @@ -177,10 +158,7 @@ jobs: python-checks: runs-on: ubuntu-latest steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 - with: - python-version: '3.12' + - uses: actions/checkout@v2 - name: Install Python dependencies run: pip install -r tasks/requirements.txt - name: Check third-party licenses @@ -195,10 +173,7 @@ jobs: doc-spellcheck: runs-on: ubuntu-latest steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 - with: - node-version: '20' + - uses: actions/checkout@v2 - name: Install markdown-spellcheck run: npm install -g markdown-spellcheck - name: Spellcheck From b1e6e28875427251a707797bb82e0abb6195bf31 Mon Sep 17 00:00:00 2001 From: Edouard Schweisguth Date: Wed, 11 Feb 2026 19:11:41 +0100 Subject: [PATCH 03/13] empty commit From 58c1737dec61cd6e5d3ff5770a4a704889941239 Mon Sep 17 00:00:00 2001 From: Edouard Schweisguth Date: Wed, 11 Feb 2026 19:20:33 +0100 Subject: [PATCH 04/13] ci: set GOPATH env var for GitHub Actions runners The Makefile checks $(GOPATH) as a Make variable and errors out if unset. actions/setup-go@v5 doesn't always export GOPATH as an env var, so set it explicitly at the workflow level. Co-Authored-By: Claude Opus 4.6 --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 90c2e3d9d..a18637515 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,6 +11,7 @@ concurrency: env: GO_VERSION: '1.25.6' + GOPATH: /home/runner/go jobs: lint-and-format: From 0a6e9ce94d9ca3973da8975650865924ccec7ec8 Mon Sep 17 00:00:00 2001 From: Edouard Schweisguth Date: Wed, 11 Feb 2026 20:11:54 +0100 Subject: [PATCH 05/13] ci: fix Ginkgo cover profile failure on GHA runners Parameterize GINKGO_PROCS (default 4, backward compatible) and use 2 on GitHub Actions to avoid cover.profile.N missing file errors when parallel processes get zero specs assigned. Co-Authored-By: Claude Opus 4.6 --- .github/workflows/ci.yml | 22 +++++++++++++++++++--- Makefile | 4 +++- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a18637515..21f64ba93 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -32,17 +32,25 @@ jobs: test: runs-on: ubuntu-latest + permissions: + id-token: write + contents: read steps: - uses: actions/checkout@v2 - uses: actions/setup-go@v5 with: go-version: ${{ env.GO_VERSION }} + - name: Get Datadog credentials + id: dd-sts + uses: DataDog/dd-sts-action@main + with: + policy: chaos-controller - name: Install tools run: make -j4 install-controller-gen install-yamlfmt install-kubebuilder install-datadog-ci - name: Run unit tests - run: make test + run: make test GINKGO_PROCS=2 env: - DATADOG_API_KEY: ${{ secrets.DATADOG_API_KEY }} + DATADOG_API_KEY: ${{ steps.dd-sts.outputs.api_key }} - name: Upload test report if: always() uses: actions/upload-artifact@v4 @@ -71,11 +79,19 @@ jobs: runs-on: ubuntu-latest needs: docker-build timeout-minutes: 45 + permissions: + id-token: write + contents: read steps: - uses: actions/checkout@v2 - uses: actions/setup-go@v5 with: go-version: ${{ env.GO_VERSION }} + - name: Get Datadog credentials + id: dd-sts + uses: DataDog/dd-sts-action@main + with: + policy: chaos-controller - name: Install tools run: make -j6 install-controller-gen install-yamlfmt install-helm install-kubebuilder install-datadog-ci - name: Download docker tarballs @@ -97,7 +113,7 @@ jobs: run: make minikube-load-all - name: Run e2e tests env: - DATADOG_API_KEY: ${{ secrets.DATADOG_API_KEY }} + DATADOG_API_KEY: ${{ steps.dd-sts.outputs.api_key }} run: | for attempt in 1 2 3; do echo "=== Attempt ${attempt}/3 ===" diff --git a/Makefile b/Makefile index cab401950..553154125 100644 --- a/Makefile +++ b/Makefile @@ -160,13 +160,15 @@ chaosli: GOOS=darwin GOARCH=$(GOARCH) CGO_ENABLED=0 go build -ldflags="-X github.com/DataDog/chaos-controller/cli/chaosli/cmd.Version=$(VERSION)" -o bin/chaosli/chaosli_darwin_$(GOARCH) ./cli/chaosli/ # https://onsi.github.io/ginkgo/#recommended-continuous-integration-configuration +GINKGO_PROCS ?= 4 + _ginkgo_test: # Run the test and write a file if succeed # Do not stop on any error -go run github.com/onsi/ginkgo/v2/ginkgo --fail-on-pending --keep-going --vv \ --cover --coverprofile=cover.profile --randomize-all \ --race --trace --json-report=report-$(GO_TEST_REPORT_NAME).json --junit-report=report-$(GO_TEST_REPORT_NAME).xml \ - --compilers=4 --procs=4 \ + --compilers=$(GINKGO_PROCS) --procs=$(GINKGO_PROCS) \ --poll-progress-after=10s --poll-progress-interval=10s \ $(GINKGO_TEST_ARGS) \ && touch report-$(GO_TEST_REPORT_NAME)-succeed From dedf7742aec1ffef4965a791b0ffde45c2b93955 Mon Sep 17 00:00:00 2001 From: Edouard Schweisguth Date: Thu, 12 Feb 2026 18:45:41 +0100 Subject: [PATCH 06/13] empty commit From 610fdf13ed0121404491882605179f6e2a7e56d6 Mon Sep 17 00:00:00 2001 From: Edouard Schweisguth Date: Thu, 12 Feb 2026 18:59:17 +0100 Subject: [PATCH 07/13] add make install golangcilint and controller-gen --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 21f64ba93..8de74d0cc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,6 +21,8 @@ jobs: - uses: actions/setup-go@v5 with: go-version: ${{ env.GO_VERSION }} + - name: Install lint tools + run: make install-golangci-lint install-controller-gen - name: Format run: | make fmt From 3667db907b5afd9b9551b51236ce53550c5da43b Mon Sep 17 00:00:00 2001 From: Edouard Schweisguth Date: Thu, 12 Feb 2026 19:14:14 +0100 Subject: [PATCH 08/13] Add uploading of code coverage reports? --- .github/workflows/ci.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8de74d0cc..786e3c8b1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -53,6 +53,11 @@ jobs: run: make test GINKGO_PROCS=2 env: DATADOG_API_KEY: ${{ steps.dd-sts.outputs.api_key }} + - name: Upload code coverage + if: success() + run: datadog-ci coverage upload --flags "type:unit-tests" . + env: + DATADOG_API_KEY: ${{ steps.dd-sts.outputs.api_key }} - name: Upload test report if: always() uses: actions/upload-artifact@v4 From 7c71768b6fb7c658e9b9b5844a7c6c8e8d60717c Mon Sep 17 00:00:00 2001 From: Edouard Schweisguth Date: Thu, 12 Feb 2026 19:34:54 +0100 Subject: [PATCH 09/13] err, cover profile name..... --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 786e3c8b1..486f04617 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -55,7 +55,7 @@ jobs: DATADOG_API_KEY: ${{ steps.dd-sts.outputs.api_key }} - name: Upload code coverage if: success() - run: datadog-ci coverage upload --flags "type:unit-tests" . + run: datadog-ci coverage upload --flags "type:unit-tests" cover.profile env: DATADOG_API_KEY: ${{ steps.dd-sts.outputs.api_key }} - name: Upload test report From 0b73e2facca689ef74684857754b273d61a2cd7d Mon Sep 17 00:00:00 2001 From: Edouard Schweisguth Date: Fri, 13 Feb 2026 09:43:07 +0100 Subject: [PATCH 10/13] force go coverage --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 486f04617..cc0509ff4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -55,7 +55,7 @@ jobs: DATADOG_API_KEY: ${{ steps.dd-sts.outputs.api_key }} - name: Upload code coverage if: success() - run: datadog-ci coverage upload --flags "type:unit-tests" cover.profile + run: datadog-ci coverage upload --format go-coverprofile --flags "type:unit-tests" cover.profile env: DATADOG_API_KEY: ${{ steps.dd-sts.outputs.api_key }} - name: Upload test report From e63470a32b8fc9ad62477350a5e8808c0fa444c8 Mon Sep 17 00:00:00 2001 From: Edouard Schweisguth Date: Fri, 13 Feb 2026 10:01:26 +0100 Subject: [PATCH 11/13] remove circle ci --- .circleci/config.yml | 299 ------------------------------------------- Makefile | 4 +- 2 files changed, 2 insertions(+), 301 deletions(-) delete mode 100644 .circleci/config.yml diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 1423604c3..000000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,299 +0,0 @@ -# Unless explicitly stated otherwise all files in this repository are licensed -# under the Apache License Version 2.0. -# This product includes software developed at Datadog (https://www.datadoghq.com/). -# Copyright 2026 Datadog, Inc. - -version: 2.1 - -commands: - go_save_cache: - description: Save $GOPATH directory as workspace - steps: - # circleci workspace are meant to be used to share data between jobs - # https://circleci.com/docs/workspaces/ - - persist_to_workspace: - # Must be an absolute path, or relative path from working_directory. This is a directory on the container which is - # taken to be the root directory of the workspace. - root: /home/circleci/go - # Must be relative path from root - paths: - - . - go_restore_cache: - description: Restore golang cache - steps: - - attach_workspace: - # Must be absolute path or relative path from working_directory - at: /home/circleci/go - python_install_requirements: - description: Install requirements in requirements.txt using pip - steps: - - run: - name: Install Python requirements - command: pip3 install -r tasks/requirements.txt - ubuntu_install_python: - description: Install python3.12 - steps: - - run: - name: Install python 3.12 - command: sudo apt update && sudo apt install python3.12 python3.12-venv - alpine_install_git: - description: Install required dependencies - steps: - - run: - name: Install git - command: apk add --no-cache git openssh - setup_github_ssh: - description: Add GitHub to SSH known hosts - steps: - - run: - name: Add github.com to known hosts - command: mkdir -p ~/.ssh && touch ~/.ssh/known_hosts && ssh-keyscan github.com >> ~/.ssh/known_hosts - -templates: - # sets the working directory to the project path - working_directory: &working_directory - working_directory: /home/circleci/go/src/github.com/DataDog/chaos-controller - -executors: - golang: - <<: *working_directory - docker: - # This is circle ci images, provides default tool installed (like docker) to ease step definition and avoid apt-get/update things - # https://circleci.com/docs/circleci-images/#next-gen-language-images - - image: cimg/go:1.25.6 - resource_class: 2xlarge - python: - <<: *working_directory - docker: - - image: python:3.8.1-alpine3.10 - bash: - <<: *working_directory - docker: - - image: bash:5.0 - ubuntu: - <<: *working_directory - machine: - image: ubuntu-2404:2025.09.1 - resource_class: xlarge # if you change the resource_class here, please adapt Makefile/minikube start cpu/memory accordingly -jobs: - # prepares the CI environment by checking out the code, - # installing a bunch of tools and downloading modules dependencies - # into the Go home path so we don't have to do it again in other - # CI jobs - # we store binaries in go/bin to ease their usage as it's already in PATH - prepare-env: - executor: golang - steps: - - checkout - - run: - name: Install binaries - command: make -j6 install-golangci-lint install-kubebuilder install-helm install-controller-gen install-datadog-ci install-yamlfmt install-mockery - - run: - name: Install protoc - command: make install-protobuf PROTOC_OS=linux - - go_save_cache - # docker build image - docker-build: - executor: golang - parameters: - target: - description: "which target to build" - type: string - steps: - - go_restore_cache - - setup_github_ssh - - setup_remote_docker: - docker_layer_caching: true - - run: - name: Build docker image for <> - command: make docker-build-<> - - persist_to_workspace: - # Must be an absolute path, or relative path from working_directory. This is a directory on the container which is - # taken to be the root directory of the workspace. - root: /home/circleci/go - # Must be relative path from root - paths: - - src/github.com/DataDog/chaos-controller/bin/<< parameters.target >>/<< parameters.target >>.tar.gz - go-make: - executor: <> - parameters: - target: - description: "which make target to call" - type: string - diff-fails: - description: "should git diff exit code be checked following ran command" - type: boolean - default: false - executor: - type: string - default: golang - with-python: - type: boolean - default: false - steps: - - go_restore_cache - - setup_github_ssh - - when: - condition: <> # if the job needs python, we install it - steps: - - ubuntu_install_python - - run: - name: run make <> - command: make <> - - when: - condition: << parameters.diff-fails >> - steps: - - run: - name: Check diffs following generate - command: git diff --exit-code - # runs the tests - test: - executor: golang - steps: - - go_restore_cache - - setup_github_ssh - - run: make test - - store_test_results: - path: report-test.xml - # run e2e tests - e2e-test: - executor: ubuntu - steps: - - go_restore_cache - - setup_github_ssh - - run: - name: Wait for Docker Daemon to be up and running - command: timeout 3m /bin/sh -c 'until docker version; do sleep 5; done' - - run: - name: Configure Minikube - command: make ci-install-minikube - - run: - name: Install requirements - command: make lima-install-cert-manager KUBECTL="minikube kubectl --" - - run: - name: Build and load images - command: make minikube-load-all - - run: - name: Run e2e tests - command: | - export PATH="/home/circleci/go/bin:${PATH}" - make e2e-test GOBIN=/home/circleci/go/bin KUBECTL="minikube kubectl --" E2E_TEST_CLUSTER_NAME="minikube" E2E_TEST_KUBECTL_CONTEXT="minikube" - no_output_timeout: 15m - max_auto_reruns: 3 - - run: - name: Save logs - when: on_fail - command: mkdir -p /tmp/logs && minikube kubectl -- -n chaos-engineering logs -lapp=chaos-controller -c manager --tail=-1 > /tmp/logs/e2e.txt - - store_test_results: - path: report-e2e-test.xml - - store_artifacts: - path: /tmp/logs - python-check: - executor: python - parameters: - target: - description: "which check to run" - type: string - steps: - - alpine_install_git - - checkout - - python_install_requirements - - run: - name: Ensure <> are up-to-date - command: inv <> - - run: - name: Check diffs following generate - command: git diff --exit-code - protobuf: - executor: golang - parameters: - target: - description: "which grpc protobuf to generate" - type: string - steps: - - go_restore_cache - - run: - name: ensures that the grpc protobuf files genereated by dogfood/<>/<>.proto are up to date - command: make generate-<>-protobuf - - run: - name: Check diffs following generate - command: git diff --exit-code ':!go.*' - # runs a spellcheck job on documentation for - doc-spellcheck: - docker: - - image: tmaier/markdown-spellcheck:latest - steps: - - checkout - - run: - name: Spell check - command: | - mdspell --report --en-us --ignore-numbers --ignore-acronyms $(find . -name vendor -prune -o -name '*.md' -print) || echo "please run 'make spellcheck' for local testing" - -workflows: - test_and_build: - jobs: - - prepare-env - - docker-build: - name: docker-build-injector - target: injector - requires: [prepare-env] - - docker-build: - name: docker-build-manager - target: manager - requires: [prepare-env] - - docker-build: - name: docker-build-handler - target: handler - requires: [prepare-env] - - go-make: - name: dependencies - target: godeps - diff-fails: true - requires: [prepare-env] - - go-make: - name: manifests - target: manifests - diff-fails: true - requires: [prepare-env] - - go-make: - name: verify-mocks - target: generate-mocks - diff-fails: true - with-python: true - requires: [prepare-env] - - go-make: - name: vet - target: vet - requires: [prepare-env] - - go-make: - name: fmt - target: fmt - requires: [prepare-env] - - go-make: - name: lint - target: lint - requires: [prepare-env] - - test: - name: test - requires: [prepare-env] - - e2e-test: - name: e2e-test - requires: - - docker-build-injector - - docker-build-manager - - docker-build-handler - - python-check: - name: third-party-licenses - target: license-check - - python-check: - name: license-header - target: header-check - - protobuf: - name: generate-disruptionlistener-protos - target: disruptionlistener - requires: [prepare-env] - - protobuf: - name: generate-chaosdogfood-protos - target: chaosdogfood - requires: [prepare-env] - - doc-spellcheck diff --git a/Makefile b/Makefile index 553154125..4b3b5db53 100644 --- a/Makefile +++ b/Makefile @@ -6,8 +6,8 @@ NOW_ISO8601 = $(shell date -u +"%Y-%m-%dT%H:%M:%S") GOOS = $(shell go env GOOS) GOARCH = $(shell go env GOARCH) -# change also circleci go build version "cimb/go:" if you change the version below -# https://github.com/DataDog/chaos-controller/blob/main/.circleci/config.yml#L85 +# change also github actions go build version "GO_VERSION:" if you change the version below +# https://github.com/DataDog/chaos-controller/blob/main/.github/workflows/ci.yml#L13 BUILDGOVERSION = 1.25.6 # GOBIN can be provided (gitlab), defined (custom user setup), or empty/guessed (default go setup) From 52a848128240e65ba726dbb93d45b055aa4ebb10 Mon Sep 17 00:00:00 2001 From: Edouard Schweisguth Date: Fri, 13 Feb 2026 10:04:18 +0100 Subject: [PATCH 12/13] do the deletion in another PR actually --- .circleci/config.yml | 299 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 299 insertions(+) create mode 100644 .circleci/config.yml diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 000000000..1423604c3 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,299 @@ +# Unless explicitly stated otherwise all files in this repository are licensed +# under the Apache License Version 2.0. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2026 Datadog, Inc. + +version: 2.1 + +commands: + go_save_cache: + description: Save $GOPATH directory as workspace + steps: + # circleci workspace are meant to be used to share data between jobs + # https://circleci.com/docs/workspaces/ + - persist_to_workspace: + # Must be an absolute path, or relative path from working_directory. This is a directory on the container which is + # taken to be the root directory of the workspace. + root: /home/circleci/go + # Must be relative path from root + paths: + - . + go_restore_cache: + description: Restore golang cache + steps: + - attach_workspace: + # Must be absolute path or relative path from working_directory + at: /home/circleci/go + python_install_requirements: + description: Install requirements in requirements.txt using pip + steps: + - run: + name: Install Python requirements + command: pip3 install -r tasks/requirements.txt + ubuntu_install_python: + description: Install python3.12 + steps: + - run: + name: Install python 3.12 + command: sudo apt update && sudo apt install python3.12 python3.12-venv + alpine_install_git: + description: Install required dependencies + steps: + - run: + name: Install git + command: apk add --no-cache git openssh + setup_github_ssh: + description: Add GitHub to SSH known hosts + steps: + - run: + name: Add github.com to known hosts + command: mkdir -p ~/.ssh && touch ~/.ssh/known_hosts && ssh-keyscan github.com >> ~/.ssh/known_hosts + +templates: + # sets the working directory to the project path + working_directory: &working_directory + working_directory: /home/circleci/go/src/github.com/DataDog/chaos-controller + +executors: + golang: + <<: *working_directory + docker: + # This is circle ci images, provides default tool installed (like docker) to ease step definition and avoid apt-get/update things + # https://circleci.com/docs/circleci-images/#next-gen-language-images + - image: cimg/go:1.25.6 + resource_class: 2xlarge + python: + <<: *working_directory + docker: + - image: python:3.8.1-alpine3.10 + bash: + <<: *working_directory + docker: + - image: bash:5.0 + ubuntu: + <<: *working_directory + machine: + image: ubuntu-2404:2025.09.1 + resource_class: xlarge # if you change the resource_class here, please adapt Makefile/minikube start cpu/memory accordingly +jobs: + # prepares the CI environment by checking out the code, + # installing a bunch of tools and downloading modules dependencies + # into the Go home path so we don't have to do it again in other + # CI jobs + # we store binaries in go/bin to ease their usage as it's already in PATH + prepare-env: + executor: golang + steps: + - checkout + - run: + name: Install binaries + command: make -j6 install-golangci-lint install-kubebuilder install-helm install-controller-gen install-datadog-ci install-yamlfmt install-mockery + - run: + name: Install protoc + command: make install-protobuf PROTOC_OS=linux + - go_save_cache + # docker build image + docker-build: + executor: golang + parameters: + target: + description: "which target to build" + type: string + steps: + - go_restore_cache + - setup_github_ssh + - setup_remote_docker: + docker_layer_caching: true + - run: + name: Build docker image for <> + command: make docker-build-<> + - persist_to_workspace: + # Must be an absolute path, or relative path from working_directory. This is a directory on the container which is + # taken to be the root directory of the workspace. + root: /home/circleci/go + # Must be relative path from root + paths: + - src/github.com/DataDog/chaos-controller/bin/<< parameters.target >>/<< parameters.target >>.tar.gz + go-make: + executor: <> + parameters: + target: + description: "which make target to call" + type: string + diff-fails: + description: "should git diff exit code be checked following ran command" + type: boolean + default: false + executor: + type: string + default: golang + with-python: + type: boolean + default: false + steps: + - go_restore_cache + - setup_github_ssh + - when: + condition: <> # if the job needs python, we install it + steps: + - ubuntu_install_python + - run: + name: run make <> + command: make <> + - when: + condition: << parameters.diff-fails >> + steps: + - run: + name: Check diffs following generate + command: git diff --exit-code + # runs the tests + test: + executor: golang + steps: + - go_restore_cache + - setup_github_ssh + - run: make test + - store_test_results: + path: report-test.xml + # run e2e tests + e2e-test: + executor: ubuntu + steps: + - go_restore_cache + - setup_github_ssh + - run: + name: Wait for Docker Daemon to be up and running + command: timeout 3m /bin/sh -c 'until docker version; do sleep 5; done' + - run: + name: Configure Minikube + command: make ci-install-minikube + - run: + name: Install requirements + command: make lima-install-cert-manager KUBECTL="minikube kubectl --" + - run: + name: Build and load images + command: make minikube-load-all + - run: + name: Run e2e tests + command: | + export PATH="/home/circleci/go/bin:${PATH}" + make e2e-test GOBIN=/home/circleci/go/bin KUBECTL="minikube kubectl --" E2E_TEST_CLUSTER_NAME="minikube" E2E_TEST_KUBECTL_CONTEXT="minikube" + no_output_timeout: 15m + max_auto_reruns: 3 + - run: + name: Save logs + when: on_fail + command: mkdir -p /tmp/logs && minikube kubectl -- -n chaos-engineering logs -lapp=chaos-controller -c manager --tail=-1 > /tmp/logs/e2e.txt + - store_test_results: + path: report-e2e-test.xml + - store_artifacts: + path: /tmp/logs + python-check: + executor: python + parameters: + target: + description: "which check to run" + type: string + steps: + - alpine_install_git + - checkout + - python_install_requirements + - run: + name: Ensure <> are up-to-date + command: inv <> + - run: + name: Check diffs following generate + command: git diff --exit-code + protobuf: + executor: golang + parameters: + target: + description: "which grpc protobuf to generate" + type: string + steps: + - go_restore_cache + - run: + name: ensures that the grpc protobuf files genereated by dogfood/<>/<>.proto are up to date + command: make generate-<>-protobuf + - run: + name: Check diffs following generate + command: git diff --exit-code ':!go.*' + # runs a spellcheck job on documentation for + doc-spellcheck: + docker: + - image: tmaier/markdown-spellcheck:latest + steps: + - checkout + - run: + name: Spell check + command: | + mdspell --report --en-us --ignore-numbers --ignore-acronyms $(find . -name vendor -prune -o -name '*.md' -print) || echo "please run 'make spellcheck' for local testing" + +workflows: + test_and_build: + jobs: + - prepare-env + - docker-build: + name: docker-build-injector + target: injector + requires: [prepare-env] + - docker-build: + name: docker-build-manager + target: manager + requires: [prepare-env] + - docker-build: + name: docker-build-handler + target: handler + requires: [prepare-env] + - go-make: + name: dependencies + target: godeps + diff-fails: true + requires: [prepare-env] + - go-make: + name: manifests + target: manifests + diff-fails: true + requires: [prepare-env] + - go-make: + name: verify-mocks + target: generate-mocks + diff-fails: true + with-python: true + requires: [prepare-env] + - go-make: + name: vet + target: vet + requires: [prepare-env] + - go-make: + name: fmt + target: fmt + requires: [prepare-env] + - go-make: + name: lint + target: lint + requires: [prepare-env] + - test: + name: test + requires: [prepare-env] + - e2e-test: + name: e2e-test + requires: + - docker-build-injector + - docker-build-manager + - docker-build-handler + - python-check: + name: third-party-licenses + target: license-check + - python-check: + name: license-header + target: header-check + - protobuf: + name: generate-disruptionlistener-protos + target: disruptionlistener + requires: [prepare-env] + - protobuf: + name: generate-chaosdogfood-protos + target: chaosdogfood + requires: [prepare-env] + - doc-spellcheck From c4001b31cc89ff29688e2352fa2c1860e26dd7a0 Mon Sep 17 00:00:00 2001 From: Edouard Schweisguth Date: Fri, 13 Feb 2026 16:18:22 +0100 Subject: [PATCH 13/13] PR comments --- .github/workflows/ci.yml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cc0509ff4..5136a38ec 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,7 +10,6 @@ concurrency: cancel-in-progress: true env: - GO_VERSION: '1.25.6' GOPATH: /home/runner/go jobs: @@ -20,7 +19,8 @@ jobs: - uses: actions/checkout@v2 - uses: actions/setup-go@v5 with: - go-version: ${{ env.GO_VERSION }} + go-version-file: go.mod + cache: true - name: Install lint tools run: make install-golangci-lint install-controller-gen - name: Format @@ -41,7 +41,8 @@ jobs: - uses: actions/checkout@v2 - uses: actions/setup-go@v5 with: - go-version: ${{ env.GO_VERSION }} + go-version-file: go.mod + cache: true - name: Get Datadog credentials id: dd-sts uses: DataDog/dd-sts-action@main @@ -93,7 +94,8 @@ jobs: - uses: actions/checkout@v2 - uses: actions/setup-go@v5 with: - go-version: ${{ env.GO_VERSION }} + go-version-file: go.mod + cache: true - name: Get Datadog credentials id: dd-sts uses: DataDog/dd-sts-action@main @@ -155,7 +157,8 @@ jobs: - uses: actions/checkout@v2 - uses: actions/setup-go@v5 with: - go-version: ${{ env.GO_VERSION }} + go-version-file: go.mod + cache: true - name: Install tools run: make -j6 install-controller-gen install-yamlfmt install-mockery install-protobuf PROTOC_OS=linux - name: Validate go dependencies