Skip to content

Commit 3a9aa84

Browse files
authored
Merge branch 'alibaba:develop' into develop
2 parents 8a78b81 + 98c9760 commit 3a9aa84

File tree

460 files changed

+25030
-13200
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

460 files changed

+25030
-13200
lines changed

.github/workflows/ci.yml

+14-7
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,10 @@ name: "Continuous Integration"
66
on:
77
push:
88
branches: [ master, develop, v1.x-develop, v1.X ]
9-
pull_request:
9+
pull_request_target:
1010
branches: [ develop, v1.x-develop ]
1111

12-
permissions:
13-
contents: read # to fetch code (actions/checkout)
12+
permissions: read-all
1413

1514
jobs:
1615
ci:
@@ -21,16 +20,20 @@ jobs:
2120
java: [8]
2221
steps:
2322
- name: "Cache Maven Repos"
24-
uses: actions/cache@v3
23+
uses: actions/cache@v4
2524
with:
2625
path: ~/.m2/repository
2726
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
2827
restore-keys: |
2928
${{ runner.os }}-maven-
29+
- if: github.event_name == 'pull_request_target'
30+
run: echo "REF=refs/pull/${{ github.event.number }}/merge" >> "$GITHUB_ENV"
3031
- name: "Checkout"
31-
uses: actions/checkout@v3
32+
uses: actions/checkout@v4
33+
with:
34+
ref: ${{ env.REF }}
3235
- name: "Set up JDK ${{ matrix.java }}"
33-
uses: actions/setup-java@v3
36+
uses: actions/setup-java@v4
3437
with:
3538
java-version: ${{ matrix.java }}
3639
distribution: 'zulu'
@@ -44,7 +47,11 @@ jobs:
4447
- name: "Test With Maven"
4548
run: mvn -Prelease-nacos clean test -DtrimStackTrace=false -e -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn
4649
- name: "Codecov"
47-
uses: codecov/[email protected]
50+
uses: codecov/[email protected]
51+
env:
52+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
4853
with:
54+
verbose: true
55+
fail_ci_if_error: true
4956
files: ./address/target/site/jacoco/jacoco.xml,./api/target/site/jacoco/jacoco.xml,./auth/target/site/jacoco/jacoco.xml,./client/target/site/jacoco/jacoco.xml,./common/target/site/jacoco/jacoco.xml,./config/target/site/jacoco/jacoco.xml,./consistency/target/site/jacoco/jacoco.xml,./console/target/site/jacoco/jacoco.xml,./core/target/site/jacoco/jacoco.xml,./logger-adapter-impl/log4j2-adapter/target/site/jacoco/jacoco.xml,./logger-adapter-impl/logback-adapter-12/target/site/jacoco/jacoco.xml,./naming/target/site/jacoco/jacoco.xml,./persistence/target/site/jacoco/jacoco.xml,./plugin-default-impl/nacos-default-auth-plugin/target/site/jacoco/jacoco.xml,./plugin-default-impl/nacos-default-control-plugin/target/site/jacoco/jacoco.xml,./plugin/auth/target/site/jacoco/jacoco.xml,./plugin/config/target/site/jacoco/jacoco.xml,./plugin/control/target/site/jacoco/jacoco.xml,./plugin/datasource/target/site/jacoco/jacoco.xml,./plugin/encryption/target/site/jacoco/jacoco.xml,./plugin/environment/target/site/jacoco/jacoco.xml,./plugin/trace/target/site/jacoco/jacoco.xml,./prometheus/target/site/jacoco/jacoco.xml,./sys/target/site/jacoco/jacoco.xml
5057
token: ${{ secrets.CODECOV_TOKEN }}

.github/workflows/pr-ci.yml

+4-3
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,9 @@ jobs:
2929
- name: Save PR number
3030
run: |
3131
mkdir -p ./pr
32-
echo ${{ github.event.number }} > ./pr/NR
33-
- uses: actions/upload-artifact@v2
32+
echo ${{ github.event.pull_request.number }} > ./pr/pr.txt
33+
- uses: actions/upload-artifact@v3
34+
name: Upload PR number
3435
with:
3536
name: pr
36-
path: pr/
37+
path: pr/pr.txt

.github/workflows/pr-comment.yml

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: "Comment on PR"
2+
3+
on:
4+
pull_request_target:
5+
types: [opened, reopened]
6+
7+
jobs:
8+
thanks-and-hint-to-document:
9+
runs-on: ubuntu-20.04
10+
permissions:
11+
pull-requests: write
12+
name: Say thanks for the PR and hint to document
13+
steps:
14+
- name: comment on the pull request
15+
uses: hasura/[email protected]
16+
with:
17+
github-token: ${{ secrets.GITHUB_TOKEN }}
18+
repository: ${{ github.repository }}
19+
number: ${{ github.event.number }}
20+
id: thanks-and-hint-to-document
21+
recreate: true
22+
message: |
23+
Thanks for your this PR. :pray:
24+
Please check again for your PR changes whether contains any usage/api/configuration change such as `Add new API `, `Add new configuration`, `Change default value of configuration`.
25+
If so, please add or update documents(markdown type) in `docs/next/` for repository [nacos-group/nacos-group.github.io](https://github.com/nacos-group/nacos-group.github.io/tree/develop-astro-nacos/src/content/docs/next)
26+
27+
---
28+
29+
感谢您提交的PR。 :pray:
30+
请再次查看您的PR内容,确认是否包含任何使用方式/API/配置参数的变更,如:`新增API`、`新增配置参数`、`修改默认配置`等操作。
31+
如果是,请确保在提交之前,在仓库[nacos-group/nacos-group.github.io](https://github.com/nacos-group/nacos-group.github.io/tree/develop-astro-nacos/src/content/docs/next)中的`docs/next/`目录下添加或更新文档(markdown格式)。

.github/workflows/pr-e2e-test.yml

+102-13
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ env:
1111
DOCKER_REPO: wuyfeedocker/nacos-ci
1212
DOCKER_REPO_B: wuyfeehub/nacos-ci
1313
TEST_REPO_NAME: nacos-group/nacos-e2e
14+
HEADER_PARAMS: "-H \"Accept: application/vnd.github+json\" -H \"Authorization: Bearer ${{ secrets.ACTION_TOKEN }}\" -H \"X-GitHub-Api-Version: 2022-11-28\""
15+
HEADER_PARAMS_WRITE_COMMENT: "-H \"Accept: application/vnd.github+json\" -H \"Authorization: Bearer ${{ secrets.ACTION_TOKEN }}\" -H \"X-GitHub-Api-Version: 2022-11-28\""
16+
BASE_URL_NACOS: https://api.github.com/repos/${GITHUB_REPOSITORY}
17+
BASE_URL_ROBOT: https://api.github.com/repos/wuyfee/nacos
1418

1519
jobs:
1620
docker:
@@ -108,20 +112,28 @@ jobs:
108112
REPLICA_COUNT: 3
109113
DATABASE: mysql
110114
NODE_PORT: 30000
115+
AUTH_ENABLED: false
116+
ACTUAL_MODE: cluster
111117
strategy:
112118
fail-fast: false
113119
matrix:
114-
mode: ["cluster","standalone"]
120+
mode: ["cluster","standalone","standalone_auth"]
115121
version: ${{ fromJSON(needs.docker.outputs.version-json) }}
116122
steps:
117123
- name: set nodeport
118124
run: |
119125
echo "NODE_PORT=$(expr $(expr $(expr $(expr ${{ strategy.job-index }} + 1) * ${{ github.run_number }}) % 30000) + 30000)" >> $GITHUB_ENV
120-
- name: set cluster params
121-
if: ${{ matrix.mode == 'standalone' }}
126+
- name: set params values
122127
run: |
123-
echo "REPLICA_COUNT=1" >> $GITHUB_ENV
124-
echo "DATABASE=embedded" >> $GITHUB_ENV
128+
if [[ ${{ matrix.mode }} == "standalone"* ]];then
129+
if [[ ${{ matrix.mode }} = "standalone_auth" ]]; then
130+
echo "AUTH_ENABLED=true" >> $GITHUB_ENV
131+
fi
132+
echo "ACTUAL_MODE=standalone" >> $GITHUB_ENV
133+
echo "REPLICA_COUNT=1" >> $GITHUB_ENV
134+
echo "DATABASE=embedded" >> $GITHUB_ENV
135+
echo ${{ matrix.mode }}-nacos-${{ github.run_id }}-${{ strategy.job-index }}
136+
fi
125137
- name: allocate docker repo
126138
run: |
127139
if [[ $(expr $(expr ${{ github.run_id }} + ${{ strategy.job-index }} ) % 2 ) -eq 1 ]]; then
@@ -149,12 +161,14 @@ jobs:
149161
values:
150162
namespace: nacos-${{ github.run_id }}-${{ strategy.job-index }}
151163
global:
152-
mode: ${{ matrix.mode }}
164+
mode: ${{ env.ACTUAL_MODE }}
153165
nacos:
154166
replicaCount: ${{ env.REPLICA_COUNT }}
155167
image:
156168
repository: ${{ env.DOCKER_REPO_ACTUAL }}
157169
tag: ${{ matrix.version }}
170+
auth:
171+
enabled: ${{ env.AUTH_ENABLED }}
158172
storage:
159173
type: ${{ env.DATABASE }}
160174
db:
@@ -165,18 +179,27 @@ jobs:
165179
service:
166180
nodePort: ${{ env.NODE_PORT }}
167181
type: ClusterIP
182+
168183
e2e-java-test:
169184
if: ${{ success() }}
170185
name: Java e2e Test
171186
needs: [docker, deploy]
172187
runs-on: ubuntu-latest
173188
timeout-minutes: 60
189+
env:
190+
CODE_PATH: java/nacos-2X
174191
strategy:
175192
fail-fast: false
176193
matrix:
177-
mode: ["cluster","standalone"]
194+
mode: ["cluster","standalone","standalone_auth"]
178195
version: ${{ fromJSON(needs.docker.outputs.version-json) }}
179196
steps:
197+
- name: set code path
198+
run: |
199+
if [[ ${{ matrix.mode }} = "standalone_auth" ]]; then
200+
echo "CODE_PATH=java/auth" >> $GITHUB_ENV
201+
echo ${{ matrix.mode }}-nacos-${{ github.run_id }}-${{ strategy.job-index }}
202+
fi
180203
- uses: apache/rocketmq-test-tool@java-dev
181204
name: java e2e test
182205
with:
@@ -192,7 +215,7 @@ jobs:
192215
REPO_NAME: ${{ env.TEST_REPO_NAME }}
193216
CODE: https://github.com/${{ env.TEST_REPO_NAME }}
194217
BRANCH: main
195-
CODE_PATH: java/nacos-2X
218+
CODE_PATH: ${{ env.CODE_PATH }}
196219
CMD: mvn clean test -B
197220
ALL_IP: null
198221
CONTAINER:
@@ -203,7 +226,6 @@ jobs:
203226
RESOURCE_REQUIRE:
204227
cpu: 2
205228
memory: 2Gi
206-
207229
- uses: actions/upload-artifact@v3
208230
if: always()
209231
name: Upload test log
@@ -296,6 +318,7 @@ jobs:
296318
BRANCH: main
297319
CODE_PATH: cpp
298320
CMD: |
321+
yum-config-manager remove centos-sclo-rh
299322
cd /root/code/cpp && make install
300323
echo "export LD_LIBRARY_PATH=/usr/local/lib" >> ~/.bashrc && source ~/.bashrc
301324
cd /root/code/cpp/nacoscpptest
@@ -454,7 +477,7 @@ jobs:
454477
BRANCH: main
455478
CODE_PATH: python
456479
CMD: |
457-
cd /root/code/python
480+
cd /root/code/python
458481
pip3 install -r requirements.txt
459482
source ~/.bashrc
460483
cd nacospythontest && pytest --junitxml ../target/surefire-reports/TEST-report.xml test/*_test.py --log-cli-level=DEBUG
@@ -480,15 +503,15 @@ jobs:
480503
481504
482505
clean:
483-
if: always()
506+
if: ${{ always() }}
484507
name: Clean
485508
needs: [docker, e2e-java-test, e2e-go-test, e2e-cpp-test, e2e-csharp-test, e2e-nodejs-test, e2e-python-test]
486509
runs-on: ubuntu-latest
487-
timeout-minutes: 60
510+
timeout-minutes: 5
488511
strategy:
489512
fail-fast: false
490513
matrix:
491-
mode: ["cluster","standalone"]
514+
mode: ["cluster","standalone","standalone_auth"]
492515
version: ${{ fromJSON(needs.docker.outputs.version-json) }}
493516
steps:
494517
- uses: apache/rocketmq-test-tool@java-dev
@@ -498,3 +521,69 @@ jobs:
498521
action: clean
499522
namespace: nacos-${{ github.run_id }}-${{ strategy.job-index }}
500523
askConfig: ${{ secrets.ASK_CONFIG_VIRGINA }}
524+
write-comment:
525+
if: ${{ always() }}
526+
name: write comment to pr
527+
needs: [docker, deploy, e2e-java-test, e2e-go-test, e2e-cpp-test, e2e-csharp-test, e2e-nodejs-test, e2e-python-test, clean]
528+
runs-on: ubuntu-latest
529+
timeout-minutes: 5
530+
steps:
531+
- name: 'Download artifact'
532+
uses: actions/[email protected]
533+
with:
534+
script: |
535+
var artifacts = await github.actions.listWorkflowRunArtifacts({
536+
owner: context.repo.owner,
537+
repo: context.repo.repo,
538+
run_id: ${{ github.event.workflow_run.id }},
539+
});
540+
541+
var matchArtifactPR = artifacts.data.artifacts.filter((artifact) => {
542+
return artifact.name == "pr"
543+
})[0];
544+
var download = await github.actions.downloadArtifact({
545+
owner: context.repo.owner,
546+
repo: context.repo.repo,
547+
artifact_id: matchArtifactPR.id,
548+
archive_format: 'zip',
549+
});
550+
var fs = require('fs');
551+
fs.writeFileSync('${{github.workspace}}/pr.zip', Buffer.from(download.data));
552+
- name: unzip pr
553+
run: |
554+
unzip pr.zip
555+
cat pr.txt
556+
pr_number=`cat pr.txt`
557+
echo "PR_NUMBER=${pr_number}" >> $GITHUB_ENV
558+
- name: write issue comment
559+
run: |
560+
echo ${{ env.PR_NUMBER }}
561+
job_status=""
562+
if [ ${{ needs.docker.result }} = 'success' ] && [ ${{ needs.deploy.result }} = 'success' ] && [ ${{ needs.e2e-java-test.result }} = 'success' ] && [ ${{ needs.e2e-go-test.result }} = 'success' ] && [ ${{ needs.e2e-cpp-test.result }} = 'success' ] && [ ${{ needs.e2e-csharp-test.result }} = 'success' ] && [ ${{ needs.e2e-nodejs-test.result }} = 'success' ] && [ ${{ needs.e2e-python-test.result }} = 'success' ]; then
563+
jobs_status='$\\color{green}{SUCCESS}$'
564+
jobs_status+="\n[DETAILS](https://github.com/${GITHUB_REPOSITORY}/actions/runs/${{ github.run_id }})"
565+
else
566+
jobs_status='$\\color{red}{FAILURE}$'
567+
jobs_status+="\n[DETAILS](https://github.com/${GITHUB_REPOSITORY}/actions/runs/${{ github.run_id }})"
568+
fi
569+
echo ${jobs_status}
570+
markdown_content="${jobs_status}"
571+
generate_content() {
572+
if [ $1 = "success" ];then
573+
echo "\n ✅ $2 $1 "
574+
else
575+
echo "\n ❌ $2 $1 "
576+
fi
577+
}
578+
markdown_content+=$(generate_content ${{ needs.docker.result }} "- docker: ")
579+
markdown_content+=$(generate_content ${{ needs.deploy.result }} "- deploy (standalone & cluster & standalone_auth): ")
580+
markdown_content+=$(generate_content ${{ needs.e2e-java-test.result }} "- e2e-java-test (standalone & cluster & standalone_auth): ")
581+
markdown_content+=$(generate_content ${{ needs.e2e-go-test.result }} "- e2e-go-test (standalone & cluster): ")
582+
markdown_content+=$(generate_content ${{ needs.e2e-cpp-test.result }} "- e2e-cpp-test (standalone & cluster): ")
583+
markdown_content+=$(generate_content ${{ needs.e2e-csharp-test.result }} "- e2e-csharp-test (standalone & cluster): ")
584+
markdown_content+=$(generate_content ${{ needs.e2e-nodejs-test.result }} "- e2e-nodejs-test (standalone & cluster): ")
585+
markdown_content+=$(generate_content ${{ needs.e2e-python-test.result }} "- e2e-python-test (standalone & cluster): ")
586+
markdown_content+=$(generate_content ${{ needs.clean.result }} "- clean (standalone & cluster & standalone_auth): ")
587+
echo "markdown_content: \n ${markdown_content}"
588+
payload=`echo "{\"body\": \"${markdown_content}\"}" | jq .`
589+
curl -L -X POST ${{ env.HEADER_PARAMS_WRITE_COMMENT }} ${{ env.BASE_URL_NACOS }}/issues/${{ env.PR_NUMBER }}/comments -d "${payload}"

0 commit comments

Comments
 (0)