Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
162 changes: 117 additions & 45 deletions .github/workflows/ci.yaml

Large diffs are not rendered by default.

47 changes: 47 additions & 0 deletions .github/workflows/codeql.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: CodeQL
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
schedule:
- cron: '30 4 * * 1'
permissions:
contents: read

jobs:
analyze:
runs-on: ubuntu-latest
timeout-minutes: 30
permissions:
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
include:
- language: go
build-mode: autobuild
- language: actions
build-mode: none
steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7

- name: Set up Go
if: matrix.language == 'go'
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7
with:
go-version-file: 'go.mod'
cache: false

- name: Initialize CodeQL
uses: github/codeql-action/init@e4fba868fa4b1b91e1fdab776edc8cfbe6e9fb81 # v4
with:
languages: ${{ matrix.language }}
build-mode: ${{ matrix.build-mode }}

- name: Analyze
uses: github/codeql-action/analyze@e4fba868fa4b1b91e1fdab776edc8cfbe6e9fb81 # v4
with:
category: "/language:${{ matrix.language }}"
31 changes: 21 additions & 10 deletions .github/workflows/docs-lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,34 +7,43 @@ on:
branches: [ main ]
permissions:
contents: read
statuses: write
checks: write
pull-requests: write
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

jobs:
vale:
name: vale-linter
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: read
checks: write
pull-requests: read
steps:
- uses: actions/checkout@v7
- uses: errata-ai/vale-action@2.1.2
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- uses: errata-ai/vale-action@85f9f7f2c5f449ac0ae5b66662961bae3f77ca6a # 2.1.2
with:
fail_on_error: 'true'
filter_mode: nofilter

doc-links:
name: Doc links
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: read
pull-requests: write
steps:
- uses: actions/checkout@v7
- uses: dorny/paths-filter@v4
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- uses: dorny/paths-filter@7b450fff21473bca461d4b92ce414b9d0420d706 # v4
id: changes
with:
filters: |
docs:
- 'docs/**'
- if: steps.changes.outputs.docs == 'true'
uses: UmbrellaDocs/action-linkspector@v1
uses: UmbrellaDocs/action-linkspector@6c637d70424624231467a4ca918be54fa3b792d0 # v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
reporter: github-pr-review
Expand All @@ -45,11 +54,12 @@ jobs:
api-reference-generated:
name: API Reference Generated
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v7
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7

- name: Set up Go
uses: actions/setup-go@v7
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7
with:
go-version-file: 'go.mod'

Expand All @@ -62,6 +72,7 @@ jobs:
ci-success-check:
name: All Docs CI checks passed
runs-on: ubuntu-latest
timeout-minutes: 5
needs: [ vale, doc-links, api-reference-generated ]
if: always()
steps:
Expand Down
18 changes: 10 additions & 8 deletions .github/workflows/release-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,34 +6,36 @@ env:
REGISTRY: ghcr.io
IMAGE_REPO: ghcr.io/clickhouse

permissions:
contents: read

jobs:
release-main:
permissions:
contents: read
packages: write
attestations: write
id-token: write
contents: write
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- name: Checkout code
uses: actions/checkout@v7
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
fetch-tags: true
fetch-depth: '0'
- name: Free disk space
uses: jlumbroso/free-disk-space@v1.3.1
uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be # v1.3.1
- name: Set up Go
uses: actions/setup-go@v7
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7
with:
go-version-file: 'go.mod'
- name: Log in to the Container registry
uses: docker/login-action@v4
uses: docker/login-action@af1e73f918a031802d376d3c8bbc3fe56130a9b0 # v4
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Install jq
uses: dcarbone/install-jq-action@v4.0.1
uses: dcarbone/install-jq-action@4fcb5062d7ce9bc4382d1a352d19ba3ba2c317c1 # v4.0.1
- name: Build operator image
run: make docker-buildx-latest
- name: Install Helm
Expand Down
60 changes: 38 additions & 22 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,22 @@ env:
VERSION: ${{ github.ref_name }}

permissions:
packages: write
attestations: write
id-token: write
contents: write
pull-requests: read
contents: read

jobs:
release-operator-image:
runs-on: ubuntu-latest
timeout-minutes: 30
permissions:
contents: read
packages: write
steps:
- name: Checkout code
uses: actions/checkout@v7
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- name: Free disk space
uses: jlumbroso/free-disk-space@v1.3.1
uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be # v1.3.1
- name: Log in to the Container registry
uses: docker/login-action@v4
uses: docker/login-action@af1e73f918a031802d376d3c8bbc3fe56130a9b0 # v4
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
Expand All @@ -37,19 +37,23 @@ jobs:

release-operator-olm-images:
runs-on: ubuntu-latest
timeout-minutes: 30
permissions:
contents: read
packages: write
steps:
- name: Checkout code
uses: actions/checkout@v7
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- name: Free disk space
uses: jlumbroso/free-disk-space@v1.3.1
uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be # v1.3.1
- name: Log in to the Container registry
uses: docker/login-action@v4
uses: docker/login-action@af1e73f918a031802d376d3c8bbc3fe56130a9b0 # v4
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Install jq
uses: dcarbone/install-jq-action@v4.0.1
uses: dcarbone/install-jq-action@4fcb5062d7ce9bc4382d1a352d19ba3ba2c317c1 # v4.0.1
- name: Set VERSION
run: echo "VERSION=${GITHUB_REF_NAME#v}" >> "$GITHUB_ENV"
- name: Build operator bundle image
Expand All @@ -63,9 +67,13 @@ jobs:

release-operator-helm-chart:
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
contents: read
packages: write
steps:
- name: Checkout code
uses: actions/checkout@v7
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- name: Install Helm
run: curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
- name: Verify Helm installation
Expand All @@ -83,15 +91,20 @@ jobs:

create-release:
runs-on: ubuntu-latest
timeout-minutes: 30
permissions:
contents: write
packages: read
pull-requests: read
needs:
- release-operator-image
- release-operator-olm-images
- release-operator-helm-chart
steps:
- name: Checkout code
uses: actions/checkout@v7
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- name: Set up Go
uses: actions/setup-go@v7
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7
with:
go-version-file: 'go.mod'
- name: Set VERSION
Expand All @@ -117,7 +130,7 @@ jobs:
run: make package-cluster-chart

- name: Log in to the Container registry
uses: docker/login-action@v4
uses: docker/login-action@af1e73f918a031802d376d3c8bbc3fe56130a9b0 # v4
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
Expand All @@ -127,7 +140,7 @@ jobs:

- name: Build Changelog
id: build_changelog
uses: mikepenz/release-changelog-builder-action@v6.2.3
uses: mikepenz/release-changelog-builder-action@c9bcd8238b6f41e05561348339429d360b1c0247 # v6.2.3
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
Expand Down Expand Up @@ -160,7 +173,7 @@ jobs:
}]
}
- name: Create GitHub Release
uses: softprops/action-gh-release@v3
uses: softprops/action-gh-release@3d0d9888cb7fd7b750713d6e236d1fcb99157228 # v3
with:
tag_name: ${{ github.ref_name }}
name: ${{github.ref_name }}
Expand Down Expand Up @@ -206,12 +219,15 @@ jobs:

community-operators-pr:
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
contents: read
needs: create-release
steps:
- name: Checkout code
uses: actions/checkout@v7
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- name: Multi-repo workflow authentication
uses: actions/create-github-app-token@v3
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3
id: generate-token
with:
app-id: ${{ secrets.WORKFLOW_AUTH_PUBLIC_APP_ID }}
Expand All @@ -221,15 +237,15 @@ jobs:
clickhouse-operator
community-operators
- name: Set up Go
uses: actions/setup-go@v7
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7
with:
go-version-file: 'go.mod'
- name: Set VERSION
run: echo "VERSION=${GITHUB_REF_NAME#v}" >> "$GITHUB_ENV"
- name: Generate operator bundle
run: make bundle
- name: Checkout community-operators fork
uses: actions/checkout@v7
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
repository: ${{ github.repository_owner }}/community-operators
token: ${{ steps.generate-token.outputs.token }}
Expand Down
5 changes: 3 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ COPY go.mod go.mod
COPY go.sum go.sum
# cache deps before building and copying source so that we don't need to re-download as much
# and so that source changes don't invalidate our downloaded layer
RUN go mod download
RUN --mount=type=cache,target=/go/pkg/mod go mod download

# Copy the go source
COPY cmd/main.go cmd/main.go
Expand All @@ -26,7 +26,8 @@ COPY internal/ internal/
# was called. For example, if we call make docker-build in a local env which has the Apple Silicon M1 SO
# the docker BUILDPLATFORM arg will be linux/arm64 when for Apple x86 it will be linux/amd64. Therefore,
# by leaving it empty we can ensure that the container and binary shipped on it will have the same platform.
RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} go build -a \
RUN --mount=type=cache,target=/go/pkg/mod --mount=type=cache,target=/root/.cache/go-build \
CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} go build \
-ldflags "-X ${VERSION_PKG}.Version=${VERSION} -X ${VERSION_PKG}.GitCommitHash=${GIT_COMMIT} -X ${VERSION_PKG}.BuildTime=${BUILD_TIME}" -o manager cmd/main.go

# Use distroless as minimal base image to package the manager binary
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,7 @@ bundle-buildx: ## Build and push bundle docker image for cross-platform support

.PHONY: scorecard
scorecard: operator-sdk
$(OPERATOR_SDK) scorecard bundle
$(OPERATOR_SDK) scorecard bundle --wait-time=2m

.PHONY: opm
OPM = $(LOCALBIN)/opm
Expand Down
4 changes: 1 addition & 3 deletions dev.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
FROM ubuntu:latest

RUN apt-get update && apt-get install -y ca-certificates
FROM alpine:3

ARG USER_ID=65532
USER $USER_ID:$USER_ID
Expand Down
4 changes: 2 additions & 2 deletions internal/controller/clickhouse/commands_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ const (
keeperHostname = "test-keeper"
clickhouseHostnameFormat = "test-clickhouse-0-%d-0"
testPassword = "test-password"
keeperImage = "clickhouse/clickhouse-keeper:26.5"
clickhouseImage = "clickhouse/clickhouse-server:26.5"
keeperImage = "clickhouse/clickhouse-keeper:26.6.2.81"
clickhouseImage = "clickhouse/clickhouse-server:26.6.2.81"
testConfigRevision = "test-revision-v1"
)

Expand Down
4 changes: 3 additions & 1 deletion internal/controller/testutil/suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,11 +214,13 @@ func CompleteVersionProbeJob(ctx context.Context, suite TestSuit, namespace, spe
ExpectWithOffset(1, suite.Client.Create(ctx, pod)).To(Succeed())
By("Setting version job pod status: " + pod.Name)
pod.Status = corev1.PodStatus{
Phase: corev1.PodSucceeded,
ContainerStatuses: []corev1.ContainerStatus{{
Name: v1.VersionProbeContainerName,
State: corev1.ContainerState{
Terminated: &corev1.ContainerStateTerminated{
Message: "ClickHouse server version " + version,
ExitCode: 0,
Message: "ClickHouse server version " + version,
},
},
}},
Expand Down
Loading
Loading