-
Notifications
You must be signed in to change notification settings - Fork 16
288 lines (256 loc) · 10.9 KB
/
release-chart.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
name: Release Charts
on:
push:
branches:
- main
- 'feature-**'
paths:
- 'charts/**'
tags:
- 'v*'
workflow_dispatch:
inputs:
ref:
description: "Why trigger?"
required: true
type: string
jobs:
release:
name: release
# depending on default permission settings for your org (contents being read-only or read-write for workloads), you will have to add permissions
# see: https://docs.github.com/en/actions/security-guides/automatic-token-authentication#modifying-the-permissions-for-the-github_token
runs-on: ubuntu-latest
if: "!startsWith(github.ref, 'refs/tags/')"
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Copy DeepFlow Agent chart
run: |
cp -rf charts/deepflow-agent charts/deepflow/charts/
- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"
- name: Install Helm
uses: azure/setup-helm@v1
with:
version: v3.9.0
- name: Run chart-releaser
uses: helm/[email protected]
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
- name: helm index
run: |
curl -o index.current https://deepflow-ce.oss-cn-beijing.aliyuncs.com/chart/latest/index.yaml||true
helm repo index .cr-release-packages/ --url https://deepflow-ce.oss-cn-beijing.aliyuncs.com/chart/latest/ --merge index.current
- uses: manyuanrong/[email protected]
with:
endpoint: "oss-accelerate.aliyuncs.com"
access-key-id: "${{ secrets.ALIYUN_OSS_ACCESS_KEY }}"
access-key-secret: "${{ secrets.ALIYUN_OSS_SECRETS_KEY }}"
- name: upload chart index
run: |
ossutil cp -rf .cr-release-packages/index.yaml oss://deepflow-ce/chart/latest/
for file in $(ls .cr-release-packages/deepflow-*.tgz)
do
ossutil cp -rf $file oss://deepflow-ce/chart/latest/
done
sync_image:
name: sync image
runs-on: ubuntu-latest
needs:
- release
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install deps - socat
run: |
sudo apt-get update
sudo apt-get install socat conntrack ebtables ipset -y
- name: Install kube key
run: |
sudo curl -sfL https://get-kk.kubesphere.io | VERSION=v2.2.2 sh -
sudo chmod +x kk
sudo ./kk version
- name: Install k8s
run: |
sudo ./kk create cluster --with-kubernetes v1.22.10 -y
- name: Interact with the cluster
run: |
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
kubectl get nodes
kubectl get sc
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Log in to GitHub Docker Registry
uses: docker/login-action@v2
with:
registry: "ghcr.io"
username: "${{ github.repository_owner }}"
password: "${{ secrets.GHCR_PUSH_TOKEN }}"
- name: Log in to Docker Registry
uses: docker/login-action@v2
with:
username: "deepflowce"
password: "${{ secrets.REGISTRY_PASS }}"
- name: Log in to ALIYUN Docker Registry
uses: docker/login-action@v2
with:
registry: "registry.cn-hongkong.aliyuncs.com"
username: "${{ secrets.REGISTRY_ALIYUN_USER }}"
password: "${{ secrets.REGISTRY_PASS }}"
- name: Log in to ALIYUN Docker Registry
uses: docker/login-action@v2
with:
registry: "registry.cn-beijing.aliyuncs.com"
username: "${{ secrets.REGISTRY_ALIYUN_USER }}"
password: "${{ secrets.REGISTRY_PASS }}"
- name: add deepflow helm repo
run: |
helm repo add deepflow https://deepflowio.github.io/deepflow-charts/
helm repo update
- name: install deepflow
run: |
helm upgrade --install deepflow -n deepflow deepflow/deepflow --create-namespace \
-f test-values.yaml
- name: install skopeo
run: |
sudo apt-get update
sudo apt-get -y install skopeo
skopeo --version
- name: sync image
run: |
sleep 300
DEPENDSIMAGE=$(kubectl get pods -n deepflow -o jsonpath={.items[*].spec.containers[*].image}|awk -F" " '{for(i=1;i<=NF;i++) print $i}' |grep -v deepflow|sort -u)
for SYNCIMAGE in $DEPENDSIMAGE
do
SORTIMAGE=$(echo $SYNCIMAGE|awk -F/ '{print $NF}')
echo $SORTIMAGE
echo "skopeo copy -a docker://$SYNCIMAGE docker://deepflowce/$SORTIMAGE"
echo "skopeo copy -a docker://$SYNCIMAGE docker://registry.cn-beijing.aliyuncs.com/deepflow-ce/$SORTIMAGE"
echo "skopeo copy -a docker://$SYNCIMAGE docker://registry.cn-hongkong.aliyuncs.com/deepflow-ce/$SORTIMAGE"
echo "skopeo copy -a docker://$SYNCIMAGE docker://ghcr.io/deepflowio/deepflow-ce/$SORTIMAGE "
docker run -v ~/.docker/config.json:/tmp/auth.json quay.io/skopeo/stable:latest copy -a docker://$SYNCIMAGE docker://deepflowce/$SORTIMAGE
docker run -v ~/.docker/config.json:/tmp/auth.json quay.io/skopeo/stable:latest copy -a docker://$SYNCIMAGE docker://registry.cn-beijing.aliyuncs.com/deepflow-ce/$SORTIMAGE
docker run -v ~/.docker/config.json:/tmp/auth.json quay.io/skopeo/stable:latest copy -a docker://$SYNCIMAGE docker://registry.cn-hongkong.aliyuncs.com/deepflow-ce/$SORTIMAGE
docker run -v ~/.docker/config.json:/tmp/auth.json quay.io/skopeo/stable:latest copy -a docker://$SYNCIMAGE docker://ghcr.io/deepflowio/deepflow-ce/$SORTIMAGE
done
- name: sync init container image
run: |
DEPENDSIMAGE=$(kubectl get pods -n deepflow -o jsonpath={.items[*].spec.initContainers[*].image}|awk -F" " '{for(i=1;i<=NF;i++) print $i}' |grep -v deepflow|sort -u)
for SYNCIMAGE in $DEPENDSIMAGE
do
SORTIMAGE=$(echo $SYNCIMAGE|awk -F/ '{print $NF}')
echo $SORTIMAGE
echo "skopeo copy -a docker://$SYNCIMAGE docker://deepflowce/$SORTIMAGE"
echo "skopeo copy -a docker://$SYNCIMAGE docker://registry.cn-beijing.aliyuncs.com/deepflow-ce/$SORTIMAGE"
echo "skopeo copy -a docker://$SYNCIMAGE docker://registry.cn-hongkong.aliyuncs.com/deepflow-ce/$SORTIMAGE"
echo "skopeo copy -a docker://$SYNCIMAGE docker://ghcr.io/deepflowio/deepflow-ce/$SORTIMAGE "
docker run -v ~/.docker/config.json:/tmp/auth.json quay.io/skopeo/stable:latest copy -a docker://$SYNCIMAGE docker://deepflowce/$SORTIMAGE
docker run -v ~/.docker/config.json:/tmp/auth.json quay.io/skopeo/stable:latest copy -a docker://$SYNCIMAGE docker://registry.cn-beijing.aliyuncs.com/deepflow-ce/$SORTIMAGE
docker run -v ~/.docker/config.json:/tmp/auth.json quay.io/skopeo/stable:latest copy -a docker://$SYNCIMAGE docker://registry.cn-hongkong.aliyuncs.com/deepflow-ce/$SORTIMAGE
docker run -v ~/.docker/config.json:/tmp/auth.json quay.io/skopeo/stable:latest copy -a docker://$SYNCIMAGE docker://ghcr.io/deepflowio/deepflow-ce/$SORTIMAGE
done
release_stable_chart:
name: release stable chart
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v') #### to stable
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: 'gh-pages'
- name: push to deepflow repo
run: |
gh repo clone deepflowio/deepflow
cd deepflow/
git checkout -b gh-pages origin/gh-pages
cp -raf ../index.yaml ./index.yaml
git config --global user.name "action"
git config --global user.email "[email protected]"
git remote set-url --push origin https://action:${{ secrets.PUSH_SECRET }}@github.com/deepflowio/deepflow
git add index.yaml
git commit -am "update charts"
git push
env:
GH_TOKEN: ${{ secrets.PUSH_SECRET }}
- uses: manyuanrong/[email protected]
with:
endpoint: "oss-accelerate.aliyuncs.com"
access-key-id: "${{ secrets.ALIYUN_OSS_ACCESS_KEY }}"
access-key-secret: "${{ secrets.ALIYUN_OSS_SECRETS_KEY }}"
- name: upload chart index
run: |
ossutil cp -rf oss://deepflow-ce/chart/latest/index.yaml oss://deepflow-ce/chart/stable/
- name: build sealos cluster image
uses: peter-evans/create-or-update-comment@v1
with:
issue-number: 78
repository: labring/cluster-image
body: |
/imagebuild_apps deepflow stable
token: "${{ secrets.PUSH_SECRET }}"
- name: build sealos cluster image
uses: peter-evans/create-or-update-comment@v1
with:
issue-number: 78
repository: labring/cluster-image
body: |
/imagebuild_apps deepflow ${{ github.ref_name }}
token: "${{ secrets.PUSH_SECRET }}"
- name: build kubesphere helm repo
uses: peter-evans/create-or-update-comment@v1
with:
issue-number: 266
repository: kubesphere/helm-charts
body: |
/build-latest-app
token: "${{ secrets.PUSH_SECRET }}"
- name: Invoke workflow in another repo with inputs
uses: benc-uk/workflow-dispatch@v1
with:
workflow: Release Charts
repo: deepflowio/deepflow-charts
token: ${{ secrets.PUSH_SECRET }}
ref: 'v6.1'
inputs: '{ "ref": "Release"}'
- name: Install k8s
run: |
sleep 30
- name: Invoke workflow in another repo with inputs
uses: benc-uk/workflow-dispatch@v1
with:
workflow: Release Charts
repo: deepflowio/deepflow-charts
token: ${{ secrets.PUSH_SECRET }}
ref: 'v6.2'
inputs: '{ "ref": "Release"}'
- name: Install k8s
run: |
sleep 30
- name: Invoke workflow in another repo with inputs
uses: benc-uk/workflow-dispatch@v1
with:
workflow: Release Charts
repo: deepflowio/deepflow-charts
token: ${{ secrets.PUSH_SECRET }}
ref: 'v6.3'
inputs: '{ "ref": "Release"}'
- name: Install k8s
run: |
sleep 30
- name: Invoke workflow in another repo with inputs
uses: benc-uk/workflow-dispatch@v1
with:
workflow: Release Charts
repo: deepflowio/deepflow-charts
token: ${{ secrets.PUSH_SECRET }}
ref: 'v6.4'
inputs: '{ "ref": "Release"}'