diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 045bb26..6e15ba8 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -324,6 +324,69 @@ jobs: reporter: java-junit path: "**/*-report.xml" + openshift-compat: + needs: [ compat-e2e-test, e2e-test ] + if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository + runs-on: [self-hosted, openshift, operator] + continue-on-error: true + timeout-minutes: 60 + concurrency: + group: openshift-compatibility + cancel-in-progress: false + permissions: + contents: read + packages: write + env: + KUBECONFIG: /home/runner/okd-install/auth/kubeconfig + VERSION: 0.0.99-test + IMG: ghcr.io/clickhouse/clickhouse-operator:test + BUNDLE_IMG: ghcr.io/clickhouse/clickhouse-operator-bundle:test + CATALOG_IMG: ghcr.io/clickhouse/clickhouse-operator-catalog:test + SINGLE_BUNDLE_IMAGE: ghcr.io/clickhouse/clickhouse-operator-bundle:test + OPENSHIFT_CATALOG_IMAGE: ghcr.io/clickhouse/clickhouse-operator-catalog:test + OPENSHIFT_CHANNEL: stable-v0 + steps: + - name: Checkout code + uses: actions/checkout@v6 + with: + persist-credentials: false + + - name: Set up Go + uses: actions/setup-go@v6 + with: + go-version-file: 'go.mod' + + - name: Log in to ghcr.io + uses: docker/login-action@v4 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push test operator + bundle + catalog + run: make docker-buildx bundle bundle-buildx catalog-buildx + + - name: Clean up cluster state from previous runs + run: sudo /usr/local/bin/okd-cleanup.sh + + - name: Install OLM tooling + run: make operator-sdk opm + + - name: Run OLM compatibility e2e + run: make test-compat-e2e-olm-openshift + + - name: Test Report + uses: dorny/test-reporter@v3 + with: + name: E2E tests + badge-title: E2E tests + reporter: java-junit + path: "**/report/*" + + - name: Wipe workspace + if: always() + run: rm -rf "$GITHUB_WORKSPACE/.git" "$GITHUB_WORKSPACE/_work" || true + ci-success-check: name: All CI checks passed runs-on: ubuntu-latest diff --git a/.github/workflows/openshift-runner-rebuild.yaml b/.github/workflows/openshift-runner-rebuild.yaml new file mode 100644 index 0000000..0879609 --- /dev/null +++ b/.github/workflows/openshift-runner-rebuild.yaml @@ -0,0 +1,35 @@ +name: OpenShift runner rebuild + +on: + schedule: + - cron: '0 6 * * 0' + workflow_dispatch: + +permissions: + contents: read + +concurrency: + group: openshift-compatibility + cancel-in-progress: false + +jobs: + rebuild: + runs-on: [self-hosted, openshift, operator] + timeout-minutes: 120 + env: + KUBECONFIG: /home/runner/okd-install/auth/kubeconfig + steps: + - name: Show pre-rebuild cluster state + run: | + oc get nodes || true + oc get co --no-headers || true + sudo virsh -c qemu:///system list --all || true + + - name: Rebuild OKD cluster + run: sudo --preserve-env=GITHUB_ACTIONS /usr/local/bin/okd-rebuild.sh + + - name: Show post-rebuild cluster state + run: | + oc get nodes + oc get clusterversion + oc get co diff --git a/Makefile b/Makefile index b37e61c..90a0eac 100644 --- a/Makefile +++ b/Makefile @@ -135,12 +135,12 @@ vet: ## Run go vet against code. .PHONY: test test: manifests generate fmt vet envtest ## Run tests. - KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test $$(go list ./... | grep -v /e2e | grep -v /deploy) \ + KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test $$(go list ./... | grep -v /e2e | grep -v /deploy | grep -v /openshift) \ --ginkgo.v .PHONY: test-ci test-ci: manifests generate fmt vet envtest ## Run tests in CI env. - KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test $$(go list ./... | grep -v /e2e | grep -v /deploy) \ + KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test $$(go list ./... | grep -v /e2e | grep -v /deploy | grep -v /openshift) \ -v -count=1 -race -coverprofile cover.out --ginkgo.v --ginkgo.junit-report=report/junit-report.xml fuzz-keeper: generate # Run keeper spec fuzz tests @@ -166,12 +166,16 @@ test-clickhouse-e2e: ## Run clickhouse e2e tests. .PHONY: test-compat-e2e # Run compatibility smoke tests across ClickHouse versions. test-compat-e2e: ## Run compatibility e2e tests (requires CLICKHOUSE_VERSION env var). - go test ./test/deploy/ -test.timeout 30m -v --ginkgo.v --ginkgo.label-filter=!olm --ginkgo.junit-report=report/junit-report.xml + go test ./test/deploy/ -test.timeout 30m -v --ginkgo.v --ginkgo.label-filter='!olm' --ginkgo.junit-report=report/junit-report.xml .PHONY: test-compat-e2e-olm # Run OLM deployment smoke test. test-compat-e2e-olm: ## Run OLM deployment e2e test on a dedicated cluster. go test ./test/deploy/ -test.timeout 30m -v --ginkgo.v --ginkgo.label-filter=olm --ginkgo.junit-report=report/junit-report.xml +.PHONY: test-compat-e2e-olm-openshift # Run OLM deployment smoke test on OpenShift. +test-compat-e2e-olm-openshift: ## Run OLM deployment e2e against an OpenShift cluster. + go test ./test/openshift/ -test.timeout 30m -v --ginkgo.v --ginkgo.junit-report=report/junit-report.xml + .PHONY: test-compat-e2e-manifest # Run compatibility smoke tests (manifests deployment only). test-compat-e2e-manifest: ## Run compatibility e2e tests using manifests deployment only (requires CLICKHOUSE_VERSION env var). go test ./test/deploy/ -test.timeout 30m -v --ginkgo.v --ginkgo.label-filter=manifest --ginkgo.junit-report=report/junit-report.xml diff --git a/ci/actionlint.yaml b/ci/actionlint.yaml index 1a7d18d..f143355 100644 --- a/ci/actionlint.yaml +++ b/ci/actionlint.yaml @@ -1,3 +1,6 @@ self-hosted-runner: labels: - amd-medium + - openshift + - operator + - openshift-okd diff --git a/ci/generate-catalog-template.sh b/ci/generate-catalog-template.sh index 5bb7428..d85d48b 100755 --- a/ci/generate-catalog-template.sh +++ b/ci/generate-catalog-template.sh @@ -1,13 +1,30 @@ #!/usr/bin/env bash set -euo pipefail -# Generate OLM catalog template with all available bundles from registry -# Usage: ./ci/generate-catalog-template.sh [] +# Default mode: list released + fast bundle tags from ghcr, emit stable-v0 +# + fast-v0 template. +# +# SINGLE_BUNDLE_IMAGE= mode: emit a one-bundle stable-v0 template +# pointing at the given image. Used by the per-PR OpenShift compatibility +# job which builds its own bundle for the PR head. -# Image repository BUNDLE_IMAGE=${1-ghcr.io/clickhouse/clickhouse-operator-bundle} -# Output file OUTPUT_FILE="catalog/clickhouse-operator-template.yaml" +mkdir -p catalog + +if [ -n "${SINGLE_BUNDLE_IMAGE:-}" ]; then + cat > "$OUTPUT_FILE" < "$OUTPUT_FILE" <