-
Notifications
You must be signed in to change notification settings - Fork 33
278 lines (263 loc) · 10.2 KB
/
Copy pathrelease.yaml
File metadata and controls
278 lines (263 loc) · 10.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
name: Create release images and GitHub Release
on:
push:
tags:
- v*.*.*
env:
REGISTRY: ghcr.io
IMAGE_REPO: ghcr.io/clickhouse
VERSION: ${{ github.ref_name }}
permissions:
packages: write
attestations: write
id-token: write
contents: write
pull-requests: read
jobs:
release-operator-image:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v7
- name: Free disk space
uses: jlumbroso/free-disk-space@v1.3.1
- name: Log in to the Container registry
uses: docker/login-action@v4
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set VERSION
run: echo "VERSION=${GITHUB_REF_NAME#v}" >> "$GITHUB_ENV"
- name: Build operator image
run: make docker-buildx-latest
release-operator-olm-images:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v7
- name: Free disk space
uses: jlumbroso/free-disk-space@v1.3.1
- name: Log in to the Container registry
uses: docker/login-action@v4
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Install jq
uses: dcarbone/install-jq-action@v3.2.0
- name: Set VERSION
run: echo "VERSION=${GITHUB_REF_NAME#v}" >> "$GITHUB_ENV"
- name: Build operator bundle image
run: make bundle bundle-buildx
- name: Build catalog
run: make catalog-buildx
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Mark catalog as latest
run: make catalog-push-latest
release-operator-helm-chart:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v7
- 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: Set VERSION
run: echo "VERSION=${GITHUB_REF_NAME#v}" >> "$GITHUB_ENV"
- name: Log in registry
run: helm registry login ghcr.io -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }}
- name: Package operator helm chart
run: make package-helmchart
- name: Build and push helm OCI image
run: make push-helmchart
- name: Build and push cluster chart OCI image
run: make push-cluster-chart
create-release:
runs-on: ubuntu-latest
needs:
- release-operator-image
- release-operator-olm-images
- release-operator-helm-chart
steps:
- name: Checkout code
uses: actions/checkout@v7
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version-file: 'go.mod'
- name: Set VERSION
run: echo "VERSION=${GITHUB_REF_NAME#v}" >> "$GITHUB_ENV"
- name: Kustomize Build
run: |
make build-installer
mv dist/install.yaml dist/clickhouse-operator.yaml
make build-installer-stripped
mv dist/install-stripped-crds.yaml dist/clickhouse-operator-stripped-crds.yaml
make build-crds
mv dist/crds.yaml dist/clickhouse-operator-crds.yaml
make build-crds-stripped
mv dist/crds-stripped.yaml dist/clickhouse-operator-crds-stripped.yaml
- 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: Package helm chart
run: make package-helmchart
- name: Package cluster chart
run: make package-cluster-chart
- name: Log in to the Container registry
uses: docker/login-action@v4
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Save controller images
run: make docker-save
- name: Build Changelog
id: build_changelog
uses: mikepenz/release-changelog-builder-action@v6.2.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
toTag: ${{ github.ref_name }}
configurationJson: |
{
"categories": [{
"title": "## 🚀 Features",
"labels": ["feature", "feat"]
},{
"title": "## 🐛 Fixes",
"labels": ["fix", "bug"]
}, {
"title": "## 🧪 Tests",
"labels": ["test"]
}, {
"title": "## 📚 Docs",
"labels": ["docs"]
}, {
"title": "## 🧹 Chores",
"labels": ["chore", "chores", "ci", "build", "refactor", "perf"]
}, {
"title": "## 📦 Uncategorized",
"labels": []
}],
"label_extractor": [{
"pattern": "^([a-zA-Z]+)(\\([^)]*\\))?!?:.*",
"on_property": "title",
"target": "$1"
}]
}
- name: Create GitHub Release
uses: softprops/action-gh-release@v3
with:
tag_name: ${{ github.ref_name }}
name: ${{github.ref_name }}
draft: true
body: |
## Install using the manifest (server-side apply)
```
kubectl apply --server-side --force-conflicts -f https://github.com/ClickHouse/clickhouse-operator/releases/download/${{github.ref_name}}/clickhouse-operator.yaml
```
For clusters restricted to client-side apply, use the description-stripped CRDs:
```
kubectl apply -f https://github.com/ClickHouse/clickhouse-operator/releases/download/${{github.ref_name}}/clickhouse-operator-stripped-crds.yaml
```
## CRDs only
```
kubectl apply --server-side --force-conflicts -f https://github.com/ClickHouse/clickhouse-operator/releases/download/${{github.ref_name}}/clickhouse-operator-crds.yaml
```
Client-side apply variant: `clickhouse-operator-crds-stripped.yaml`
## Install using helmchart
```
helm install clickhouse-operator oci://ghcr.io/clickhouse/clickhouse-operator-helm \
--version=${{env.VERSION}} \
--create-namespace \
-n clickhouse-operator-system
```
## Changelog
${{steps.build_changelog.outputs.changelog}}
generate_release_notes: false
append_body: true
files: |
dist/clickhouse-operator.yaml
dist/clickhouse-operator-stripped-crds.yaml
dist/clickhouse-operator-crds.yaml
dist/clickhouse-operator-crds-stripped.yaml
clickhouse-operator-helm-${{env.VERSION}}.tgz
clickhouse-cluster-helm-${{env.VERSION}}.tgz
clickhouse-operator_${{env.VERSION}}_*.tar.gz
community-operators-pr:
runs-on: ubuntu-latest
needs: create-release
steps:
- name: Checkout code
uses: actions/checkout@v7
- name: Multi-repo workflow authentication
uses: actions/create-github-app-token@v3
id: generate-token
with:
app-id: ${{ secrets.WORKFLOW_AUTH_PUBLIC_APP_ID }}
private-key: ${{ secrets.WORKFLOW_AUTH_PUBLIC_PRIVATE_KEY }}
owner: ${{ github.repository_owner }}
repositories: |
clickhouse-operator
community-operators
- name: Set up Go
uses: actions/setup-go@v6
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
with:
repository: ${{ github.repository_owner }}/community-operators
token: ${{ steps.generate-token.outputs.token }}
path: community-operators
fetch-depth: 0
- name: Configure git identity
working-directory: community-operators
run: |
git config user.name "clickhouse-operator-bot"
git config user.email "clickhouse-operator-bot@users.noreply.github.com"
- name: Sync fork main with upstream
working-directory: community-operators
run: |
git remote add upstream https://github.com/k8s-operatorhub/community-operators.git
git fetch upstream main
git checkout -B main upstream/main
git push origin main --force
- name: Stage bundle in operators/clickhouse-operator/${VERSION}
working-directory: community-operators
run: |
BRANCH="clickhouse-operator-${VERSION}"
git checkout -b "${BRANCH}"
TARGET="operators/clickhouse-operator/${VERSION}"
rm -rf "${TARGET}"
mkdir -p "${TARGET}"
cp -r ../bundle/manifests "${TARGET}/"
cp -r ../bundle/metadata "${TARGET}/"
- name: Commit and push branch
working-directory: community-operators
run: |
BRANCH="clickhouse-operator-${VERSION}"
git add "operators/clickhouse-operator/${VERSION}"
git commit -s -m "operator clickhouse-operator (${VERSION})"
git push origin "${BRANCH}" --force
- name: Create pull request to fork
env:
GH_TOKEN: ${{ steps.generate-token.outputs.token }}
working-directory: community-operators
run: |
BRANCH="clickhouse-operator-${VERSION}"
gh pr create \
--repo ${{ github.repository_owner }}/community-operators \
--title "operator clickhouse-operator (${VERSION})" \
--body "Bundle for clickhouse-operator ${VERSION}. Generated from https://github.com/${{ github.repository }}/releases/tag/${{ github.ref_name }}. Merge then submit upstream to k8s-operatorhub/community-operators following https://k8s-operatorhub.github.io/community-operators/packaging-operator/." \
--head "${BRANCH}" \
--base main