-
Notifications
You must be signed in to change notification settings - Fork 16
339 lines (331 loc) · 11.5 KB
/
operator-early-adoption.yaml
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
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
---
name: Custom build
on:
workflow_dispatch:
inputs:
vs_branch:
required: true
default: main
description: "Version Service branch with the new build to checkout"
image:
required: true
description: "Full name of the upstream image to test"
upstream:
type: choice
description: "The upstream operator"
required: true
options:
- percona-xtradb-cluster-operator
- percona-server-mongodb-operator
- percona-postgresql-operator
push: # !!! remove before merge
branches:
- EVEREST-1563-operator-early-adoption
permissions:
contents: read
packages: write
checks: write
pull-requests: write
jobs:
test:
name: Test
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
go-version: [ 1.23.x ]
may-fail: [ false ]
continue-on-error: ${{ matrix.may-fail }}
runs-on: ubuntu-20.04
env:
VERSION: ""
CLI_PREREQUISITES: ">= 1.2.0"
K8S_PREREQUISITES: ">= 1.27"
VS_PORT: 8081
VS_URL: ""
ARCH: ""
OS: ""
TOOLS_PATH: "/opt/tools/bin"
# !!! revert to using inputs
# UPSTREAM_REPO: ${{ github.event.inputs.upstream }}
UPSTREAM_REPO: "percona-xtradb-cluster-operator"
# IMAGE: ${{ github.event.inputs.image }}
IMAGE: "docker.io/percona/percona-xtradb-cluster-operator:1.15.1-community-bundle"
VS_BRANCH: ${{ github.event.inputs.vs_branch }}
TIMESTAMP: ""
steps:
- name: Get current date
id: date
run: |
echo "::set-output name=date::$(date +'%Y%m%d%H%M%S')"
- name: Set environment variables
run: |
echo "ARCH=$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/')" >> $GITHUB_ENV
echo "OS=$(uname | awk '{print tolower($0)}')" >> $GITHUB_ENV
echo "VS_URL=http://localhost:$VS_PORT" >> $GITHUB_ENV
echo "TIMESTAMP=${{ steps.date.outputs.date }}" >> $GITHUB_ENV
echo "VERSION=1.10000.0-rc${{ steps.date.outputs.date }}" >> $GITHUB_ENV
- name: Set up Go release
uses: percona-platform/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
#
# - name: Set GO_VERSION environment variable
# run: |
# go version
# echo "GO_VERSION=$(go version)" >> $GITHUB_ENV
#
# - name: Enable Go modules cache
# uses: percona-platform/cache@v3
# with:
# path: ~/go/pkg/mod
# key: ${{ matrix.os }}-go-${{ matrix.go-version }}-modules-${{ hashFiles('**/go.sum') }}
# restore-keys: |
# ${{ matrix.os }}-go-${{ matrix.go-version }}-modules-
#
# - name: Enable Go build cache
# uses: percona-platform/cache@v3
# with:
# path: ~/.cache/go-build
# key: ${{ matrix.os }}-go-${{ matrix.go-version }}-build-${{ github.ref }}-${{ hashFiles('**') }}
# restore-keys: |
# ${{ matrix.os }}-go-${{ matrix.go-version }}-build-${{ github.ref }}-
# ${{ matrix.os }}-go-${{ matrix.go-version }}-build-
#
# - name: Start local Kubernetes cluster with the local registry
# uses: medyagh/setup-minikube@latest
# id: minikube
# with:
# cpus: 2
# memory: 2000m
#
# - name: Login to GitHub Container Registry
# uses: docker/login-action@v3
# with:
# username: ${{ secrets.DOCKERHUB_USERNAME }}
# password: ${{ secrets.DOCKERHUB_TOKEN }}
#
# - name: VS - checkout
# uses: actions/checkout@v4
# with:
# repository: Percona-Lab/percona-version-service
# ref: ${{ env.VS_BRANCH }}
# path: percona-version-service
# token: ${{ secrets.ROBOT_TOKEN }}
#
# - name: VS - update
# run: |
# cd percona-version-service
# make init
# # create an entry for the new Everest version
# printf "version: $VERSION\nsupported:\n cli: '$CLI_PREREQUISITES'\n kubernetes: '$K8S_PREREQUISITES'" > "sources/metadata/everest/$VERSION.yaml"
#
#
# - name: Build and Push VS dev image
# uses: docker/build-push-action@v6
# with:
# context: percona-version-service
# push: true
# tags: perconalab/version-service:${{ env.VERSION }}
#
#
# - name: Apply VS manifest
# run: |
# kubectl create ns everest-system
# # !!! change tag and repo
# sed -i "s/perconalab\/version-service:.*/perconalab\/everest-catalog:test/g" percona-version-service/deploy.yaml
# kubectl apply -f percona-version-service/deploy.yaml -n everest-system
# kubectl wait --for=jsonpath='{.status.readyReplicas}'=3 deployment/percona-version-service -n everest-system
# kubectl port-forward svc/percona-version-service $VS_PORT:80 -n everest-system &
#
# - name: Operator - check out
# uses: actions/checkout@v4
# with:
# repository: percona/everest-operator
# path: everest-operator
# token: ${{ secrets.ROBOT_TOKEN }}
#
# - name: Operator - install operator-sdk
# run: |
# mkdir -p $TOOLS_PATH
# echo $TOOLS_PATH >> $GITHUB_PATH
#
# export OPERATOR_SDK_DL_URL=https://github.com/operator-framework/operator-sdk/releases/download/v1.25.2
# curl -LO ${OPERATOR_SDK_DL_URL}/operator-sdk_${OS}_${ARCH}
#
# gpg --keyserver keyserver.ubuntu.com --recv-keys 052996E2A20B5C7E
#
# curl -LO ${OPERATOR_SDK_DL_URL}/checksums.txt
# curl -LO ${OPERATOR_SDK_DL_URL}/checksums.txt.asc
# gpg -u "Operator SDK (release) <[email protected]>" --verify checksums.txt.asc
#
# grep operator-sdk_${OS}_${ARCH} checksums.txt | sha256sum -c -
#
# chmod +x operator-sdk_${OS}_${ARCH}
# mv operator-sdk_${OS}_${ARCH} $TOOLS_PATH/operator-sdk
#
# - name: Operator - build and bundle
# run: |
# cd everest-operator
# make build manifests bundle
#
# - name: Operator - setup Docker meta for everest-operator
# id: operator_meta
# uses: docker/metadata-action@v5
# with:
# images: |
# perconalab/everest-operator
# tags: |
# type=raw,value=${{ env.VERSION }}
#
# - name: Operator - setup Docker meta for everest-operator-bundle
# id: bundle_meta
# uses: docker/metadata-action@v5
# with:
# images: |
# perconalab/everest-operator-bundle
# tags: |
# type=raw,value=${{ env.VERSION }}
#
# - name: Operator - push everest-operator image
# uses: docker/build-push-action@v6
# with:
# context: everest-operator
# push: true
# tags: ${{ steps.operator_meta.outputs.tags }}
#
# - name: Operator - push everest-operator-bundle image
# uses: docker/build-push-action@v6
# with:
# context: everest-operator
# push: true
# tags: ${{ steps.bundle_meta.outputs.tags }}
# file: everest-operator/bundle.Dockerfile
#
# - name: Catalog - checkout
# uses: actions/checkout@v4
# with:
# repository: percona/everest-catalog
# path: everest-catalog
# token: ${{ secrets.ROBOT_TOKEN }}
#
# - name: Catalog - update veneer file
# run: |
# cd everest-catalog/tools
# go run . \
# --veneer-file ../veneer/everest-operator.yaml \
# --channel fast-v0 \
# --new-version ${{ env.VERSION }} \
#
# cd ..
# curl -Lo /tmp/opm https://github.com/operator-framework/operator-registry/releases/download/v1.44.0/${OS}-${ARCH}-opm
# chmod +x /tmp/opm
# /tmp/opm alpha render-template basic --skip-tls -o yaml < veneer/everest-operator.yaml > catalog/everest-operator/catalog.yaml
#
# # Check if catalog has the new version listed
# if ! grep -q "$VERSION$" catalog/everest-operator/catalog.yaml; then
# echo "catalog/everest-operator/catalog.yaml does not include the version $VERSION"
# exit 1
# fi
#
# # Add a new record to the upstream veneer
# yq e ".Stable.Bundles += {\"Image\": \"$IMAGE\"}" veneer/${UPSTREAM_REPO}.yaml > temp.yaml && mv temp.yaml veneer/${UPSTREAM_REPO}.yaml
#
# # Generate upstream catalog
# /tmp/opm alpha render-template semver --skip-tls -o yaml < veneer/${UPSTREAM_REPO}.yaml > catalog/${UPSTREAM_REPO}/catalog.yaml
#
# # Check if upstream catalog has the new image listed
# if ! grep -q "$IMAGE$" catalog/${UPSTREAM_REPO}/catalog.yaml; then
# echo "catalog/${UPSTREAM_REPO}/catalog.yaml does not include the version $IMAGE"
# exit 1
# fi
#
# git diff
#
# - name: Catalog - setup Docker meta for everest-catalog
# id: catalog_meta
# uses: docker/metadata-action@v5
# with:
# images: |
# perconalab/everest-catalog
# tags: |
# type=raw,value=${{ env.VERSION }}
#
# - name: Catalog - push everest-catalog image
# uses: docker/build-push-action@v6
# with:
# context: everest-catalog
# push: true
# tags: ${{ steps.catalog_meta.outputs.tags }}
# file: everest-catalog/everest-catalog.Dockerfile
#
#
# - name: Everest - check out
# uses: actions/checkout@v4
# with:
# token: ${{ secrets.ROBOT_TOKEN }}
# ref: EVEREST-1563-operator-early-adoption # !!! delete before merge
#
# - name: Everest - setup golang
# uses: actions/setup-go@v5
# with:
# go-version-file: "./go.mod"
#
#
# - name: Everest - update sources
# run: |
# # Update deploy manifest
# sed -i "s/perconalab\/everest.*/perconalab\/everest:$VERSION/g" deploy/quickstart-k8s.yaml
# sed -i "s/percona\/everest.*/perconalab\/everest:$VERSION/g" deploy/quickstart-k8s.yaml
#
# # Change version in Makefile
# sed -i "s/RELEASE_VERSION ?=.*/RELEASE_VERSION ?= v$VERSION/g" Makefile
#
# # Change release manifest link: use local path to the manifest file in version.go
# sed -i "s/https:\/\/raw.githubusercontent.com\/percona\/everest\/v%s\///g" pkg/version/version.go
#
# - name: Everest UI - setup pnpm
# uses: pnpm/action-setup@v4
# with:
# version: 9.4.0
#
# - name: Everest UI - run with Node 20
# uses: actions/setup-node@v4
# with:
# node-version: 20.x
# cache: "pnpm"
# cache-dependency-path: ui/pnpm-lock.yaml
#
# - name: Everest UI - build
# run: |
# cd ui
# pnpm install
# EVEREST_OUT_DIR=${GITHUB_WORKSPACE}/public/dist/ pnpm build
#
# - name: Everest - build binary
# run: |
# if [[ $IS_RC == 1 ]]; then
# CGO_ENABLED=0 GOOS=linux GOARCH=amd64 make rc
# else
# CGO_ENABLED=0 GOOS=linux GOARCH=amd64 make release
# fi
#
# - name: Everest - push Everest image
# uses: docker/build-push-action@v6
# with:
# context: .
# push: true
# tags: perconalab/everest:${{ env.VERSION }}
#
# - name: Provision Everest using CLI
# shell: bash
# run: |
# make feature-build-cli
# ./bin/everestctl install -v \
# --version $VERSION \
# --version-metadata-url $VS_URL \
# --operator.mongodb \
# --operator.postgresql \
# --operator.xtradb-cluster \
# --skip-wizard \
# --namespaces everest