forked from apache/rocketmq
-
Notifications
You must be signed in to change notification settings - Fork 0
258 lines (246 loc) · 8.81 KB
/
snapshot-automation.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
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: Snapshot Daily Release Automation
on:
schedule: # schedule the job to run at 12 a.m. daily
- cron: "0 0 * * *"
workflow_dispatch:
inputs:
branch:
description: 'The branch to trigger the workflow, The default branch is "develop" when both branch and commit_id are empty'
required: false
commit_id:
description: 'The commit id to trigger the workflow. Do not set branch and commit_id together'
required: false
rocketmq_version:
description: 'Name of the SNAPSHOT version to be generated. The default version is "$VERSION-stable-SNAPSHOT"'
required: false
env:
MAVEN_OPTS: -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.httpconnectionManager.ttlSeconds=120
DOCKER_REPO: apache/rocketmq-ci
jobs:
dist-tar:
name: Build dist tar
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout develop
if: github.event.inputs.branch == '' && github.event.inputs.commit_id == ''
uses: actions/checkout@v3
with:
ref: develop
- name: Checkout specific commit
if: github.event.inputs.branch == '' && github.event.inputs.commit_id != ''
uses: actions/checkout@v3
with:
ref: ${{ github.event.inputs.commit_id }}
- name: Checkout specific branch
if: github.event.inputs.branch != '' && github.event.inputs.commit_id == ''
uses: actions/checkout@v3
with:
ref: ${{ github.event.inputs.branch }}
- uses: actions/setup-java@v3
with:
distribution: "temurin"
java-version: "8"
cache: "maven"
- name: Build distribution tar
env:
MAVEN_SETTINGS: ${{ github.workspace }}/.github/asf-deploy-settings.xml
run: |
mvn -Prelease-all -DskipTests -Dspotbugs.skip=true clean install -U
- uses: actions/upload-artifact@v3
name: Upload distribution tar
with:
name: rocketmq
path: distribution/target/rocketmq*/rocketmq*
docker-build:
if: ${{ success() }}
name: Docker images
needs: [ dist-tar ]
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
matrix:
base-image: [ "ubuntu" ]
java-version: [ "8" ]
steps:
- uses: actions/checkout@v3
with:
repository: apache/rocketmq-docker.git
ref: master
path: rocketmq-docker
- uses: actions/download-artifact@v3
name: Download distribution tar
with:
name: rocketmq
path: rocketmq
- name: docker-login
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and save docker images
id: build-images
run: |
cd rocketmq-docker/image-build-ci
version=${{ github.event.pull_request.number || github.ref_name }}-$(uuidgen)
mkdir versionlist
touch versionlist/"${version}-`echo ${{ matrix.base-image }} | sed -e "s/:/-/g"`"
sh ./build-image-local.sh ${version} ${{ matrix.base-image }} ${{ matrix.java-version }} ${DOCKER_REPO}
- uses: actions/upload-artifact@v3
name: Upload distribution tar
with:
name: versionlist
path: rocketmq-docker/image-build-ci/versionlist/*
list-version:
if: always()
name: List version
needs: [ docker-build ]
runs-on: ubuntu-latest
timeout-minutes: 30
outputs:
version-json: ${{ steps.show_versions.outputs.version-json }}
steps:
- uses: actions/download-artifact@v3
name: Download versionlist
with:
name: versionlist
path: versionlist
- name: Show versions
id: show_versions
run: |
a=(`ls versionlist`)
printf '%s\n' "${a[@]}" | jq -R . | jq -s .
echo version-json=`printf '%s\n' "${a[@]}" | jq -R . | jq -s .` >> $GITHUB_OUTPUT
deploy-rocketmq:
if: ${{ success() }}
name: Deploy RocketMQ
needs: [ list-version,docker-build ]
runs-on: ubuntu-latest
timeout-minutes: 60
strategy:
matrix:
version: ${{ fromJSON(needs.list-version.outputs.version-json) }}
steps:
- uses: apache/rocketmq-test-tool@1a646589accad17070423eabf0f54925e52b0666
name: Deploy rocketmq
with:
action: "deploy"
ask-config: "${{ secrets.ASK_CONFIG_VIRGINA }}"
test-version: "${{ matrix.version }}"
chart-git: "https://github.com/apache/rocketmq-docker.git"
chart-branch: "master"
chart-path: "./rocketmq-k8s-helm"
job-id: ${{ strategy.job-index }}
helm-values: |
nameserver:
image:
repository: ${{env.DOCKER_REPO}}
tag: ${{ matrix.version }}
broker:
image:
repository: ${{env.DOCKER_REPO}}
tag: ${{ matrix.version }}
proxy:
image:
repository: ${{env.DOCKER_REPO}}
tag: ${{ matrix.version }}
java-grpc-e2e-test:
if: ${{ success() }}
name: E2E Test
needs: [ list-version, deploy-rocketmq ]
runs-on: ubuntu-latest
timeout-minutes: 60
strategy:
matrix:
version: ${{ fromJSON(needs.list-version.outputs.version-json) }}
steps:
- uses: apache/rocketmq-test-tool@1a646589accad17070423eabf0f54925e52b0666
name: e2e test
with:
action: "test"
ask-config: "${{ secrets.ASK_CONFIG_VIRGINA }}"
test-version: "${{ matrix.version }}"
test-code-git: "https://github.com/apache/rocketmq-e2e.git"
test-code-branch: "master"
test-code-path: java/e2e
test-cmd: "mvn -B test"
job-id: ${{ strategy.job-index }}
- name: Publish Test Report
uses: mikepenz/action-junit-report@v3
if: always() # always run even if the previous step fails
with:
report_paths: '**/test_report/TEST-*.xml'
annotate_only: true
include_passed: true
detailed_summary: true
- uses: actions/upload-artifact@v3
if: always()
name: Upload test log
with:
name: testlog.txt
path: testlog.txt
clean:
if: always()
name: Clean
needs: [ list-version, java-grpc-e2e-test ]
runs-on: ubuntu-latest
timeout-minutes: 60
strategy:
matrix:
version: ${{ fromJSON(needs.list-version.outputs.version-json) }}
steps:
- uses: apache/rocketmq-test-tool@1a646589accad17070423eabf0f54925e52b0666
name: clean
with:
action: "clean"
ask-config: "${{ secrets.ASK_CONFIG_VIRGINA }}"
test-version: "${{ matrix.version }}"
job-id: ${{ strategy.job-index }}
snapshot:
runs-on: ubuntu-latest
needs: [ java-grpc-e2e-test ]
env:
NEXUS_DEPLOY_USERNAME: ${{ secrets.NEXUS_USER }}
NEXUS_DEPLOY_PASSWORD: ${{ secrets.NEXUS_PW }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: develop
persist-credentials: false
- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: 8
distribution: "temurin"
cache: "maven"
- name: Update default pom version
if: github.event.inputs.rocketmq_version == ''
run: |
VERSION=$(mvn -q -Dexec.executable='echo' -Dexec.args='${project.version}' --non-recursive exec:exec)
VERSION=$(echo $VERSION | awk -F '-SNAPSHOT' '{print $1}')
VERSION=$VERSION-stable-SNAPSHOT
mvn versions:set -DnewVersion=$VERSION
- name: Update User-defined pom version
if: github.event.inputs.rocketmq_version != ''
run: |
mvn versions:set -DnewVersion=${{ github.event.inputs.rocketmq_version }}
- name: Deploy to ASF Snapshots Repository
timeout-minutes: 40
run: mvn clean deploy -DskipTests=true --settings .github/asf-deploy-settings.xml