-
Notifications
You must be signed in to change notification settings - Fork 187
247 lines (227 loc) · 9.38 KB
/
release-image.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
name: Release Images
on:
schedule:
- cron: '0 0 * * 1-5' # Runs at 00:00 UTC on Mon to Friday
workflow_dispatch:
inputs:
release_version:
description: 'The release version of image'
required: false
default: 'latest'
dockerfile:
description: 'release specify Dockerfile or empty to release all images'
required: false
default: ''
type: choice
options:
- ""
- Dockerfile
- Dockerfile-charts
- Dockerfile-dataprotection
- Dockerfile-datascript
- Dockerfile-dev
- Dockerfile-tools
release:
types:
- published
env:
GH_TOKEN: ${{ github.token }}
RELEASE_VERSION: ${{ github.ref_name }}
jobs:
release-version:
runs-on: ubuntu-latest
outputs:
release-version: ${{ steps.get_release_version.outputs.release_version }}
release-version-bump: ${{ steps.get_release_version.outputs.release_version_bump }}
git-commit: ${{ steps.get_git_info.outputs.git_commit }}
git-version: ${{ steps.get_git_info.outputs.git_version }}
steps:
- uses: actions/checkout@v4
- name: Get Release Version
id: get_release_version
run: |
RELEASE_VERSION="latest"
if [[ ! -z "${{ inputs.release_version }}" ]]; then
RELEASE_VERSION="${{ inputs.release_version }}"
elif [[ "${{ env.RELEASE_VERSION }}" == "main" ]]; then
RELEASE_VERSION="latest"
elif [[ ! -z "${{ env.RELEASE_VERSION }}" ]]; then
RELEASE_VERSION=${{ env.RELEASE_VERSION }}
fi
echo release_version=$RELEASE_VERSION >> $GITHUB_OUTPUT
RELEASE_VERSION_BUMP="${RELEASE_VERSION/v/}"
echo release_version_bump=$RELEASE_VERSION_BUMP >> $GITHUB_OUTPUT
- name: get git info
id: get_git_info
run: |
GIT_COMMIT=$(git rev-list -1 HEAD)
GIT_VERSION=$(git describe --always --abbrev=0 --tag)
echo git_commit=$GIT_COMMIT >> $GITHUB_OUTPUT
echo git_version=$GIT_VERSION >> $GITHUB_OUTPUT
release-image:
if: ${{ inputs.dockerfile == '' || inputs.dockerfile == 'Dockerfile' }}
needs: release-version
uses: apecloud/apecloud-cd/.github/workflows/[email protected]
with:
MAKE_OPS_PRE: "generate"
IMG: "apecloud/kubeblocks"
VERSION: "${{ needs.release-version.outputs.release-version }}"
GO_VERSION: "1.21"
APECD_REF: "v0.1.24"
DOCKERFILE_PATH: "./docker/Dockerfile"
BUILDX_ARGS: |
VERSION=${{ needs.release-version.outputs.release-version }}
GIT_COMMIT=${{ needs.release-version.outputs.git-commit }}
GIT_VERSION=${{ needs.release-version.outputs.git-version }}
secrets: inherit
release-tools-image:
if: ${{ inputs.dockerfile == '' || inputs.dockerfile == 'Dockerfile-tools' }}
needs: release-version
uses: apecloud/apecloud-cd/.github/workflows/[email protected]
with:
MAKE_OPS_PRE: "module generate test-go-generate"
IMG: "apecloud/kubeblocks-tools"
VERSION: "${{ needs.release-version.outputs.release-version }}"
GO_VERSION: "1.21"
APECD_REF: "v0.1.24"
DOCKERFILE_PATH: "./docker/Dockerfile-tools"
secrets: inherit
release-datascript-image:
if: ${{ inputs.dockerfile == '' || inputs.dockerfile == 'Dockerfile-datascript' }}
needs: release-version
uses: apecloud/apecloud-cd/.github/workflows/[email protected]
with:
IMG: "apecloud/kubeblocks-datascript"
VERSION: "${{ needs.release-version.outputs.release-version }}"
APECD_REF: "v0.1.24"
DOCKERFILE_PATH: "./docker/Dockerfile-datascript"
secrets: inherit
release-dataprotection-image:
if: ${{ inputs.dockerfile == '' || inputs.dockerfile == 'Dockerfile-dataprotection' }}
needs: release-version
uses: apecloud/apecloud-cd/.github/workflows/[email protected]
with:
IMG: "apecloud/kubeblocks-dataprotection"
VERSION: "${{ needs.release-version.outputs.release-version }}"
APECD_REF: "v0.1.24"
DOCKERFILE_PATH: "./docker/Dockerfile-dataprotection"
secrets: inherit
release-charts-image:
if: ${{ github.event_name == 'workflow_dispatch' && (inputs.dockerfile == '' || inputs.dockerfile == 'Dockerfile-charts') }}
needs: release-version
uses: apecloud/apecloud-cd/.github/workflows/[email protected]
with:
MAKE_OPS_PRE: "helm-package VERSION=${{ needs.release-version.outputs.release-version-bump }}"
IMG: "apecloud/kubeblocks-charts"
VERSION: "${{ needs.release-version.outputs.release-version }}"
GO_VERSION: "1.21"
APECD_REF: "v0.1.24"
DOCKERFILE_PATH: "./docker/Dockerfile-charts"
secrets: inherit
release-dev-image:
if: ${{ github.event_name == 'workflow_dispatch' && (inputs.dockerfile == '' || inputs.dockerfile == 'Dockerfile-dev') }}
needs: release-version
uses: apecloud/apecloud-cd/.github/workflows/[email protected]
with:
IMG: "apecloud/kubeblocks-dev"
VERSION: "${{ needs.release-version.outputs.release-version }}"
APECD_REF: "v0.1.24"
DOCKERFILE_PATH: "./docker/Dockerfile-dev"
CONTEXT: "./docker"
secrets: inherit
release-message:
runs-on: ubuntu-latest
needs: [ release-image, release-tools-image, release-datascript-image, release-dataprotection-image ]
outputs:
content-result: ${{ steps.release_message.outputs.content_result }}
release-version: ${{ steps.release_message.outputs.release_version }}
if: ${{ always() && github.event.action == 'published' }}
steps:
- uses: actions/checkout@v4
- name: release message
id: release_message
run: |
ARTIFACT_KEY="${{ env.RELEASE_VERSION }}-image"
touch ${ARTIFACT_KEY}
echo 'artifact_key='${ARTIFACT_KEY} >> $GITHUB_OUTPUT
CONTENT="error"
if [[ "${{ needs.release-image.result }}" == "success" && "${{ needs.release-tools-image.result }}" == "success" && "${{ needs.release-datascript-image.result }}" == "success" && "${{ needs.release-dataprotection-image.result }}" == "success" ]]; then
CONTENT="success"
echo "success" > ${ARTIFACT_KEY}
else
echo "error" > ${ARTIFACT_KEY}
fi
echo 'content_result='$CONTENT >> $GITHUB_OUTPUT
echo release_version=${{ env.RELEASE_VERSION }} >> $GITHUB_OUTPUT
- name: delete cache
continue-on-error: true
run: |
bash .github/utils/utils.sh --type 17 --tag-name "${{ steps.release_message.outputs.artifact_key }}"
- name: Save Artifact
id: cache-artifact-save
uses: actions/cache/save@v3
with:
path: |
${{ steps.release_message.outputs.artifact_key }}
key: ${{ steps.release_message.outputs.artifact_key }}
send-message:
needs: [ release-message ]
if: ${{ always() && github.event.action == 'published' }}
uses: apecloud/apecloud-cd/.github/workflows/[email protected]
with:
TYPE: "2"
CONTENT: "release image ${{ needs.release-message.outputs.release-version }} ${{ needs.release-message.outputs.content-result }}"
APECD_REF: "v0.1.38"
secrets: inherit
release-result:
if: github.event.action == 'published'
needs: [ release-message ]
runs-on: ubuntu-latest
strategy:
matrix:
type: [image, chart]
steps:
- name: Restore ${{ matrix.type }} Artifact
id: cache-artifact-restore
uses: actions/cache/restore@v3
with:
path: |
${{ env.RELEASE_VERSION }}-${{ matrix.type }}
key: ${{ env.RELEASE_VERSION }}-${{ matrix.type }}
- name: check release result
run: |
release_result=$( cat ${{ env.RELEASE_VERSION }}-${{ matrix.type }} )
if [[ "$release_result" != "success" ]]; then
exit 1
fi
e2e-kbcli:
needs: [ release-message, release-result ]
uses: apecloud/apecloud-cd/.github/workflows/[email protected]
strategy:
fail-fast: false
matrix:
test-type: [ apecloud-mysql|postgresql|redis|mongodb|kafka|asmysql|elasticsearch|zookeeper|rabbitmq|damengdb|kingbase,
pulsar|mysqlscale|weaviate|qdrant|smartengine|greptimedb|nebula|risingwave|starrocks|etcd|oceanbase,
foxlake|orioledb|oracle-mysql|official-pg|openldap|polardbx|opensearch|vllm|tdengine|milvus|clickhouse,
pika|ggml|mariadb|tidb|xinference|oracle|opengauss|influxdb|flink|solr|doris,
halo|mogdb|oceanbase-ent|starrocks-ent|apecloud-postgresql|yashandb|redis-cluster|camellia-redis-proxy|dmdb|minio|orchestrator ]
with:
GITHUB_REPO: "apecloud/kubeblocks"
BRANCH_NAME: "main"
WORKFLOW_ID: "e2e-kbcli.yml"
APECD_REF: "v0.1.35"
VERSION: "${{ needs.release-message.outputs.release-version }}"
EXTRA_ARGS: "TEST_TYPE=${{ matrix.test-type }}#CLOUD_PROVIDER=${{ vars.CLOUD_PROVIDER }}"
secrets: inherit
delete-cache:
needs: e2e-kbcli
runs-on: ubuntu-latest
strategy:
matrix:
type: [image, chart]
steps:
- uses: actions/checkout@v4
- name: delete ${{ matrix.type }} cache
continue-on-error: true
run: |
bash .github/utils/utils.sh --type 17 --tag-name "${{ env.RELEASE_VERSION }}-${{ matrix.type }}"