Skip to content

feat: support keeper on a different namespace #580

feat: support keeper on a different namespace

feat: support keeper on a different namespace #580

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@v6
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: Lint with golangci-lint
uses: golangci/golangci-lint-action@v9
with:
version: v2.11.4
- 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'
check-crd-compat:
# Only run on pull requests, and skip when the PR is explicitly labeled as
# an intentional CRD-breaking change. The job is not part of ci-success-check,
# so a failure here does not block the aggregate gate.
if: |
github.event_name == 'pull_request' &&
!contains(github.event.pull_request.labels.*.name, 'crd-breaking-change')
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version-file: 'go.mod'
- name: Check CRD backward compatibility
run: make check-crd-compat CRD_BASE_REF=${{ github.event.pull_request.base.sha }}
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@v6
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@v6
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@v3
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@v6
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@v6
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-k8s-all-deploy-methods
k8s_image: v1.28.15
clickhouse_version: "26.3"
deploy_target: test-compat-e2e
- name: maximal-k8s-all-deploy-methods
k8s_image: v1.35.1
clickhouse_version: "26.3"
deploy_target: test-compat-e2e
- name: supported-clickhouse-compatibility
k8s_image: v1.30.13
clickhouse_version: "26.3,26.2,26.1,25.8"
deploy_target: test-compat-e2e-manifest
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Free disk space
uses: jlumbroso/free-disk-space@v1.3.0
- name: Set up Go
uses: actions/setup-go@v6
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 ${{ matrix.deploy_target }}
env:
CLICKHOUSE_VERSION: ${{ matrix.clickhouse_version }}
- name: Upload test report
uses: actions/upload-artifact@v6
if: ${{ !cancelled() }}
with:
name: e2e-report-${{ matrix.name }}
path: "**/report/*"
if-no-files-found: error
overwrite: true
e2e-test:
needs: [ lint ]
strategy:
fail-fast: false
matrix:
scope: [ test-keeper-e2e, test-clickhouse-e2e ]
runs-on: [self-hosted, amd-medium]
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Set up Go
uses: actions/setup-go@v6
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@v6
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 e2e test reports
uses: actions/download-artifact@v8
with:
pattern: e2e-report-*
- name: Test Report
uses: dorny/test-reporter@v3
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, check-crd-compat ]
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