-
Notifications
You must be signed in to change notification settings - Fork 16
199 lines (175 loc) · 7.62 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
name: Release Charts
on:
push:
branches:
- v6.1
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:
- uses: dev-drprasad/[email protected]
with:
delete_release: true # default: true
delete_draft_release: true # default: false; only applicable if delete_release == true
tag_name: deepflow-agent-6.1.8
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: dev-drprasad/[email protected]
with:
delete_release: true # default: true
delete_draft_release: true # default: false; only applicable if delete_release == true
tag_name: deepflow-6.1.8
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- 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: |
rm -rf index.current
curl -o index.current https://deepflow-ce.oss-cn-beijing.aliyuncs.com/chart/stable/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/stable/
ossutil cp -rf .cr-release-packages/index.yaml oss://deepflow-ce/chart/stable/
ossutil cp -rf .cr-release-packages/deepflow-6.1.8.tgz oss://deepflow-ce/chart/latest/
ossutil cp -rf .cr-release-packages/deepflow-agent-6.1.8.tgz oss://deepflow-ce/chart/latest/
- name: push to deepflow repo
run: |
git clone https://github.com/deepflowio/deepflow.git -b gh-pages
mkdir -p .cr-release-packages-agent
mkdir -p .cr-release-packages
mv .cr-release-packages/deepflow-agent*.tgz .cr-release-packages-agent/
helm repo index .cr-release-packages/ --url https://github.com/deepflowio/deepflow-charts/releases/download/deepflow-6.1.8/ --merge deepflow/index.yaml
helm repo index .cr-release-packages-agent/ --url https://github.com/deepflowio/deepflow-charts/releases/download/deepflow-agent-6.1.8/ --merge deepflow/index.yaml
rm -rf deepflow
gh repo clone deepflowio/deepflow
cd deepflow/
git checkout -b gh-pages origin/gh-pages
cp -raf ../.cr-release-packages-agent/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 }}
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 --version 6.1.8 \
-f test-values.yaml
- name: install skopeo
run: |
sudo apt-get update
sudo apt-get -y install skopeo
- name: sync image
run: |
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 "
skopeo copy -a docker://$SYNCIMAGE docker://deepflowce/$SORTIMAGE
skopeo copy -a docker://$SYNCIMAGE docker://registry.cn-beijing.aliyuncs.com/deepflow-ce/$SORTIMAGE
skopeo copy -a docker://$SYNCIMAGE docker://registry.cn-hongkong.aliyuncs.com/deepflow-ce/$SORTIMAGE
skopeo copy -a docker://$SYNCIMAGE docker://ghcr.io/deepflowio/deepflow-ce/$SORTIMAGE
done