-
Notifications
You must be signed in to change notification settings - Fork 29
341 lines (297 loc) · 13.9 KB
/
bundle-release.yml
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
340
341
name: Function-Mesh Bundle Release (Manually)
on:
workflow_dispatch:
inputs:
tag:
description: 'Version Tag'
required: true
openshift:
description: 'Publish to openshift certificated'
required: true
default: true
type: boolean
operatorhub:
description: 'Publish to operatorhub.io'
required: true
default: true
type: boolean
jobs:
operatorhub:
name: publish to operatorhub.io
runs-on: ubuntu-latest
if: ${{ inputs.operatorhub }}
steps:
- name: clean disk
run: |
sudo swapoff -a
sudo rm -rf /swapfile /usr/share/dotnet /usr/local/lib/android /opt/ghc
sudo apt clean
docker rmi $(docker images -q) -f
df -h
- name: checkout
uses: actions/checkout@v2
with:
ref: ${{ inputs.tag }}
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Set up GO 1.20.4
uses: actions/setup-go@v1
with:
go-version: 1.20.4
id: go
- name: InstallKubebuilder
run: |
curl -L https://github.com/kubernetes-sigs/kubebuilder/releases/download/v2.3.1/kubebuilder_2.3.1_linux_amd64.tar.gz | tar -xz -C /tmp/
sudo mv /tmp/kubebuilder_2.3.1_linux_amd64 /usr/local/kubebuilder
export PATH=$PATH:/usr/local/kubebuilder/bin
- name: Install operator-sdk
run: |
RELEASE_VERSION=v1.14.0
curl -LO "https://github.com/operator-framework/operator-sdk/releases/download/${RELEASE_VERSION}/operator-sdk_linux_amd64"
chmod +x operator-sdk_linux_amd64 && sudo mkdir -p /usr/local/bin/ && sudo mv operator-sdk_linux_amd64 /usr/local/bin/operator-sdk
- name: Set up yq
run: |
sudo wget https://github.com/mikefarah/yq/releases/download/v4.30.4/yq_linux_amd64 -O /usr/bin/yq
sudo chmod +x /usr/bin/yq
yq --help
- name: Get vertical-pod-autoscaler crd
run: |
wget https://raw.githubusercontent.com/kubernetes/autoscaler/master/vertical-pod-autoscaler/deploy/vpa-v1-crd-gen.yaml -O config/crd/bases/vpa-v1-crd.yaml
- name: build release
id: build_release
env:
VERSION: ${{ inputs.tag }}
IMAGE_TAG_BASE: streamnative/function-mesh
CATALOG_BRANCH_TAG: latest
run: |
# convert vx.y.z to x.y.z because a valid semver is needed in creating the bundle
VERSION=$(echo $VERSION|cut -c 2-)
make release
- name: Login to Quay
uses: docker/login-action@v1
with:
registry: quay.io
username: ${{ secrets.QUAY_DOCKER_USERNAME }}
password: ${{ secrets.QUAY_DOCKER_PASSWORD }}
- name: Build RedHat certificated bundle And Publish to Quay
env:
VERSION: ${{ inputs.tag }}
DOCKER_REPO: quay.io/streamnativeio
IMAGE_TAG_BASE: quay.io/streamnativeio/function-mesh
CATALOG_BRANCH_TAG: latest
run: |
# convert vx.y.z to x.y.z because a valid semver is needed in creating the bundle
VERSION=$(echo $VERSION|cut -c 2-)
echo $VERSION
make redhat-certificated-image-build redhat-certificated-image-push redhat-certificated-bundle redhat-certificated-bundle-build redhat-certificated-bundle-push
- name: Checkout streamnative community-operators
uses: actions/checkout@v3
with:
repository: streamnative/community-operators
path: community-operators
token: ${{ secrets.SNBOT_GITHUB_TOKEN }}
- name: Copy bundle to community-operators and create pr
env:
GITHUB_TOKEN: ${{ secrets.SNBOT_GITHUB_TOKEN }}
VERSION: ${{ inputs.tag }}
run: |
pushd community-operators
git config --global user.email "[email protected]"
git config --global user.name "streamnativebot"
export VERSION=$(echo $VERSION|cut -c 2-)
echo $VERSION
export BRANCH=function-mesh-operator-$VERSION
echo $BRANCH
git push -d origin $BRANCH || echo 'Skip branch deletion'
# sync with the upstream repo https://github.com/k8s-operatorhub/community-operators.git
git remote add upstream https://github.com/k8s-operatorhub/community-operators.git
git fetch upstream
git checkout -b upstream upstream/main
git pull
git checkout -b $BRANCH
export TARGET_DIR=operators/function-mesh/$VERSION
mkdir -p $TARGET_DIR
cp -rf ../bundle.Dockerfile $TARGET_DIR
cp -rf ../bundle/* $TARGET_DIR
git add .
git commit -s -m "operator function-mesh ($VERSION)"
git push --set-upstream origin $BRANCH
wget https://raw.githubusercontent.com/streamnative/function-mesh/master/.github/openshift/community-operators -O ../.github/community-operators
gh pr create --title "operator function-mesh ($VERSION)" -F ../.github/community-operators -R k8s-operatorhub/community-operators
popd
openshift:
name: publish to openshift certificated
runs-on: ubuntu-latest
if: ${{ inputs.openshift }}
steps:
- name: clean disk
run: |
sudo swapoff -a
sudo rm -rf /swapfile /usr/share/dotnet /usr/local/lib/android /opt/ghc
sudo apt clean
docker rmi $(docker images -q) -f
df -h
- name: checkout
uses: actions/checkout@v2
with:
ref: ${{ inputs.tag }}
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Set up GO 1.20.4
uses: actions/setup-go@v1
with:
go-version: 1.20.4
id: go
- name: InstallKubebuilder
run: |
curl -L https://github.com/kubernetes-sigs/kubebuilder/releases/download/v2.3.1/kubebuilder_2.3.1_linux_amd64.tar.gz | tar -xz -C /tmp/
sudo mv /tmp/kubebuilder_2.3.1_linux_amd64 /usr/local/kubebuilder
export PATH=$PATH:/usr/local/kubebuilder/bin
- name: Install operator-sdk
run: |
RELEASE_VERSION=v1.14.0
curl -LO "https://github.com/operator-framework/operator-sdk/releases/download/${RELEASE_VERSION}/operator-sdk_linux_amd64"
chmod +x operator-sdk_linux_amd64 && sudo mkdir -p /usr/local/bin/ && sudo mv operator-sdk_linux_amd64 /usr/local/bin/operator-sdk
- name: Set up yq
run: |
sudo wget https://github.com/mikefarah/yq/releases/download/v4.30.4/yq_linux_amd64 -O /usr/bin/yq
sudo chmod +x /usr/bin/yq
yq --help
- name: Get vertical-pod-autoscaler crd
run: |
wget https://raw.githubusercontent.com/kubernetes/autoscaler/master/vertical-pod-autoscaler/deploy/vpa-v1-crd-gen.yaml -O config/crd/bases/vpa-v1-crd.yaml
- name: Use the master hack scripts
uses: actions/checkout@v2
with:
path: master_fm
ref: master
- name: build release
id: build_release
env:
VERSION: ${{ inputs.tag }}
IMAGE_TAG_BASE: streamnative/function-mesh
CATALOG_BRANCH_TAG: latest
run: |
VERSION=$(echo $VERSION|cut -c 2-)
make release
- name: Login to Quay for RedHat container certification
uses: docker/login-action@v1
with:
registry: quay.io
username: ${{ secrets.REDHAT_CERTIFICATED_CONTAINER_REGISTRY_USER }}
password: ${{ secrets.REDHAT_CERTIFICATED_CONTAINER_REGISTRY_PASSWORD }}
- name: Login to RedHat Connect registry
uses: docker/login-action@v1
with:
registry: https://registry.connect.redhat.com
username: ${{ secrets.REDHAT_CONNECT_REGISTRY_USER }}
password: ${{ secrets.REDHAT_CONNECT_REGISTRY_PASSWORD }}
- name: Build Openshift certificated container And Publish to Quay
env:
VERSION: ${{ inputs.tag }}
DOCKER_REPO: registry.connect.redhat.com/streamnative
IMAGE_TAG_BASE: registry.connect.redhat.com/streamnative/function-mesh
CATALOG_BRANCH_TAG: latest
CONTAINER_IMAGE_CERTIFICATION_PROJECT_ID: ${{ secrets.CONTAINER_IMAGE_CERTIFICATION_PROJECT_ID }}
run: |
VERSION=$(echo $VERSION|cut -c 2-)
echo $VERSION
make redhat-certificated-image-build
docker tag $IMAGE_TAG_BASE:v$VERSION quay.io/redhat-isv-containers/$CONTAINER_IMAGE_CERTIFICATION_PROJECT_ID:v$VERSION
docker push quay.io/redhat-isv-containers/$CONTAINER_IMAGE_CERTIFICATION_PROJECT_ID:v$VERSION
- name: Trigger openshift preflight test
env:
VERSION: ${{ inputs.tag }}
CONTAINER_IMAGE_CERTIFICATION_PROJECT_ID: ${{ secrets.CONTAINER_IMAGE_CERTIFICATION_PROJECT_ID }}
PFLT_PYXIS_API_TOKEN: ${{ secrets.PFLT_PYXIS_API_TOKEN }}
REDHAT_CERTIFICATED_CONTAINER_AUTHFILE: ${{ secrets.REDHAT_CERTIFICATED_CONTAINER_AUTHFILE }}
run: |
echo $VERSION
export TARGET_DIR=/tmp/artifacts
export AUTHFILE=/tmp/authfile.json
mkdir $TARGET_DIR
echo $REDHAT_CERTIFICATED_CONTAINER_AUTHFILE > $AUTHFILE
cat $AUTHFILE
docker run -i --rm --security-opt=label=disable --env PFLT_LOGLEVEL=trace --env PFLT_ARTIFACTS=/artifacts --env PFLT_LOGFILE=/artifacts/preflight.log --env PFLT_CERTIFICATION_PROJECT_ID=$CONTAINER_IMAGE_CERTIFICATION_PROJECT_ID --env PFLT_PYXIS_API_TOKEN=$PFLT_PYXIS_API_TOKEN --env PFLT_DOCKERCONFIG=/temp-authfile.json -v $TARGET_DIR:/artifacts -v $AUTHFILE:/temp-authfile.json:ro quay.io/opdev/preflight:stable check container quay.io/redhat-isv-containers/$CONTAINER_IMAGE_CERTIFICATION_PROJECT_ID:$VERSION --submit
sleep 60s
- name: Wait for Scan to Complete
env:
VERSION: ${{ inputs.tag }}
DOCKER_REPO: registry.connect.redhat.com/streamnative
IMAGE_TAG_BASE: registry.connect.redhat.com/streamnative/function-mesh
CATALOG_BRANCH_TAG: latest
CONTAINER_IMAGE_CERTIFICATION_PROJECT_ID: ${{ secrets.CONTAINER_IMAGE_CERTIFICATION_PROJECT_ID }}
PFLT_PYXIS_API_TOKEN: ${{ secrets.PFLT_PYXIS_API_TOKEN }}
TIMEOUT_IN_MINS: 10
run: |
echo $VERSION
source master_fm/hack/publish-rhel.sh
wait_for_container_scan "$CONTAINER_IMAGE_CERTIFICATION_PROJECT_ID" "$VERSION" "$PFLT_PYXIS_API_TOKEN" "$TIMEOUT_IN_MINS"
- name: Wait for image release
env:
VERSION: ${{ inputs.tag }}
DOCKER_REPO: registry.connect.redhat.com/streamnative
IMAGE_TAG_BASE: registry.connect.redhat.com/streamnative/function-mesh
CATALOG_BRANCH_TAG: latest
CONTAINER_IMAGE_CERTIFICATION_PROJECT_ID: ${{ secrets.CONTAINER_IMAGE_CERTIFICATION_PROJECT_ID }}
PFLT_PYXIS_API_TOKEN: ${{ secrets.PFLT_PYXIS_API_TOKEN }}
TIMEOUT_IN_MINS: 10
run: |
echo $VERSION
source master_fm/hack/publish-rhel.sh
publish_the_image "$CONTAINER_IMAGE_CERTIFICATION_PROJECT_ID" "$VERSION" "$PFLT_PYXIS_API_TOKEN"
wait_for_container_publish "$CONTAINER_IMAGE_CERTIFICATION_PROJECT_ID" "$VERSION" "$PFLT_PYXIS_API_TOKEN" "$TIMEOUT_IN_MINS"
sync_tags "$CONTAINER_IMAGE_CERTIFICATION_PROJECT_ID" "$VERSION" "$PFLT_PYXIS_API_TOKEN"
docker rmi quay.io/redhat-isv-containers/$CONTAINER_IMAGE_CERTIFICATION_PROJECT_ID:$VERSION
docker pull registry.connect.redhat.com/streamnative/function-mesh:$VERSION
docker inspect registry.connect.redhat.com/streamnative/function-mesh:$VERSION
- name: Build the openshift bundle
env:
VERSION: ${{ inputs.tag }}
DOCKER_REPO: registry.connect.redhat.com/streamnative
IMAGE_TAG_BASE: registry.connect.redhat.com/streamnative/function-mesh
CATALOG_BRANCH_TAG: latest
CONTAINER_IMAGE_CERTIFICATION_PROJECT_ID: ${{ secrets.CONTAINER_IMAGE_CERTIFICATION_PROJECT_ID }}
run: |
VERSION=$(echo $VERSION|cut -c 2-)
echo $VERSION
make redhat-certificated-bundle redhat-certificated-bundle-build
- name: Checkout streamnative certified-operators
uses: actions/checkout@v3
with:
repository: streamnative/certified-operators
path: certified-operators
token: ${{ secrets.SNBOT_GITHUB_TOKEN }}
- name: Copy bundle to certified-operators and create pr
env:
GITHUB_TOKEN: ${{ secrets.SNBOT_GITHUB_TOKEN }}
VERSION: ${{ inputs.tag }}
run: |
pushd certified-operators
git config --global user.email "[email protected]"
git config --global user.name "streamnativebot"
echo $VERSION
export BRANCH=function-mesh-operator-$VERSION
echo $BRANCH
git push -d origin $BRANCH || echo 'Skip branch deletion'
# sync with the upstream repo https://github.com/redhat-openshift-ecosystem/certified-operators.git
git remote add upstream https://github.com/redhat-openshift-ecosystem/certified-operators.git
git fetch upstream
git checkout -b upstream upstream/main
git pull
git checkout -b $BRANCH
export TARGET_DIR=operators/function-mesh/$VERSION
mkdir -p $TARGET_DIR
cp -rf ../bundle.Dockerfile $TARGET_DIR
cp -rf ../bundle/* $TARGET_DIR
git add .
git commit -s -m "operator function-mesh ($VERSION)"
git push --set-upstream origin $BRANCH
gh pr create --title "operator function-mesh ($VERSION)" --body "Signed-off-by: streamnativebot [email protected]" -R redhat-openshift-ecosystem/certified-operators
popd