Skip to content

test(e2e):Run controller in e2e tests process, dump namespace obejcts… #479

test(e2e):Run controller in e2e tests process, dump namespace obejcts…

test(e2e):Run controller in e2e tests process, dump namespace obejcts… #479

Workflow file for this run

name: Operator CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
env:
kind-version: 'v0.31.0'
permissions:
contents: read
statuses: write
checks: write
pull-requests: write
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- name: Go Tidy
run: go mod tidy && git diff --exit-code
- name: Check controller-gen generated
run: make generate && git diff --exit-code
- name: Check manifests generated
run: make manifests && git diff --exit-code
- name: Check CRD backward compatibility
run: |
if [ "${{ github.event_name }}" = "pull_request" ]; then
make check-crd-compat CRD_BASE_REF=${{ github.event.pull_request.base.sha }}
else
make check-crd-compat CRD_BASE_REF=${{ github.event.before }}
fi
- name: Lint with golangci-lint
uses: golangci/golangci-lint-action@v7
with:
version: v2.9.0
- name: Lint with codespell
uses: codespell-project/actions-codespell@v2.2
with:
config: ci/.codespellrc
- name: actionlint
uses: raven-actions/actionlint@v2
with:
flags: '-config-file ci/actionlint.yaml'
bundle:
runs-on: ubuntu-latest
env:
VERSION: 0.0.1
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- name: Generate bundle
run: make bundle
- name: Create k8s Kind Cluster
uses: helm/kind-action@v1
with:
cluster_name: 'test-bundle'
version: ${{ env.kind-version }}
- name: Export kubeconfig
run: kind export kubeconfig --name test-bundle
- name: Create bundle image
run: make bundle-build
- name: Load image into Kind cluster
run: kind load docker-image ghcr.io/clickhouse/clickhouse-operator-bundle:v0.0.1 --name test-bundle
- name: Run scorecard tests
run: make scorecard
build_and_test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- name: Go Mod
run: go mod download
- name: Go Mod Verify
run: go mod verify
- name: Build
run: go build -v cmd/main.go
- name: Run tests
run: |
go list ./... | grep -v /e2e
make test-ci
- name: Test Report
uses: dorny/test-reporter@v2
if: ${{ !cancelled() }}
with:
name: Unit tests
badge-title: Unit tests
path: "**/report/*.xml"
reporter: java-junit
fuzz_specs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- name: Go Mod
run: go mod download
- name: Run fuzz tests
run: make fuzz
helm-test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- name: Install Helm
run: curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
- name: Verify Helm installation
run: helm version
- name: Check helmchart generated
run: make generate-helmchart-ci && git diff --exit-code dist/chart/
- name: Build Helm Chart Dependencies
run: make build-helmchart-dependencies
- name: Lint Helm Chart
run: helm lint ./dist/chart
compat-e2e-test:
runs-on: [ubuntu-latest]
strategy:
fail-fast: false
matrix:
include:
- name: "Minimal supported kubernetes with LTS ClickHouse release"
k8s_image: v1.28.15
clickhouse_version: "26.3"
- name: "Latest kubernetes version with LTS ClickHouse release"
k8s_image: v1.35.1
clickhouse_version: "26.3"
- name: "Supported ClickHouse versions"
k8s_image: v1.30.13
clickhouse_version: "26.3,26.2,26.1,25.8"
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- name: Create k8s Kind Cluster
uses: helm/kind-action@v1
with:
cluster_name: kind
version: ${{ env.kind-version }}
config: ci/kind-cluster.config
node_image: "kindest/node:${{ matrix.k8s_image }}"
- name: Go Mod
run: go mod download
- name: Install tools
run: make operator-sdk opm
- name: Pre-pull ClickHouse images into Kind
run: |
for version in $(echo "${{ matrix.clickhouse_version }}" | tr ',' ' '); do
for image in clickhouse/clickhouse-keeper clickhouse/clickhouse-server; do
docker pull "docker.io/${image}:${version}"
kind load docker-image "docker.io/${image}:${version}"
done
done
- name: Run compatibility e2e tests
run: make test-compat-e2e
env:
CLICKHOUSE_VERSION: ${{ matrix.clickhouse_version }}
- name: Upload test report
uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: compat-e2e-report-${{ strategy.job-index }}
path: "**/report/*"
if-no-files-found: error
overwrite: true
e2e-test:
needs: [ lint, build_and_test ]
strategy:
fail-fast: false
matrix:
scope: [ test-keeper-e2e, test-clickhouse-e2e ]
runs-on: [self-hosted, func-tester]
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- name: Go Mod
run: go mod download
- name: Create k8s Kind Cluster
uses: helm/kind-action@v1
with:
cluster_name: kind
version: ${{ env.kind-version }}
config: ci/kind-cluster.config
node_image: "kindest/node:v1.34.3" # Can't use newer node image as self-hosted runners use cgroups v1
- name: Run e2e tests
run: make ${{ matrix.scope }}
- name: Upload test report
uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: e2e-report-${{ matrix.scope }}
path: "**/report/*"
if-no-files-found: error
overwrite: true
e2e-report:
needs: [compat-e2e-test, e2e-test]
runs-on: ubuntu-latest
if: ${{ !cancelled() }}
steps:
- name: Download all compat test reports
uses: actions/download-artifact@v4
with:
pattern: compat-e2e-report-*
- name: Download all e2e test reports
uses: actions/download-artifact@v4
with:
pattern: e2e-report-*
- name: Test Report
uses: dorny/test-reporter@v2
with:
name: E2E tests
badge-title: E2E tests
reporter: java-junit
artifact: "/(.*)e2e-report(.*)/"
path: "**/*.xml"
ci-success-check:
name: All CI checks passed
runs-on: ubuntu-latest
needs: [ lint, bundle, build_and_test, fuzz_specs, helm-test, compat-e2e-test, e2e-test ]
if: always()
steps:
- name: Determine CI status
id: status
run: |
if [[ "${{ contains(needs.*.result, 'failure') }}" == "true" || "${{ contains(needs.*.result, 'cancelled') }}" == "true" ]]; then
echo "One or more CI jobs failed or were cancelled"
exit 1
else
echo "All required jobs passed successfully"
fi