Skip to content

Commit

Permalink
Merge pull request #11266 from alibaba/develop
Browse files Browse the repository at this point in the history
2.3.0-BETA release
  • Loading branch information
KomachiSion committed Oct 19, 2023
2 parents cb0422e + 3a2fee5 commit ca6d151
Show file tree
Hide file tree
Showing 958 changed files with 41,763 additions and 12,639 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/pr-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: PR-CI

on:
pull_request:
branches: [ develop, v1.x-develop ]

jobs:
dist-tar:
name: Build distribution tar
runs-on: ubuntu-latest
timeout-minutes: 120
steps:
- uses: actions/checkout@v3
with:
submodules: true
- uses: actions/setup-java@v3
with:
distribution: "temurin"
java-version: "8"
cache: "maven"
- name: Build distribution tar
run: |
mvn -Prelease-nacos -DskipTests clean install -U -e -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn
- uses: actions/upload-artifact@v3
name: Upload distribution tar
with:
name: nacos
path: distribution/target/nacos-server-*-SNAPSHOT.tar.gz
- name: Save PR number
run: |
mkdir -p ./pr
echo ${{ github.event.number }} > ./pr/NR
- uses: actions/upload-artifact@v2
with:
name: pr
path: pr/
210 changes: 210 additions & 0 deletions .github/workflows/pr-e2e-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,210 @@
name: E2E test for pull request


on:
workflow_run:
workflows: ["PR-CI"]
types:
- completed

env:
DOCKER_REPO: wuyfeedocker/nacos-ci
ACTIONS_ALLOW_UNSECURE_COMMANDS: true

jobs:
docker:
runs-on: ubuntu-latest
if: >
github.event.workflow_run.event == 'pull_request' &&
github.event.workflow_run.conclusion == 'success'
timeout-minutes: 30
strategy:
matrix:
base-image: ["ubuntu"]
java-version: ["8"]
steps:
- name: 'Download artifact'
uses: actions/github-script@v3.1.0
with:
script: |
var artifacts = await github.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: ${{ github.event.workflow_run.id }},
});
var matchArtifactNacos = artifacts.data.artifacts.filter((artifact) => {
return artifact.name == "nacos"
})[0];
var download = await github.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: matchArtifactNacos.id,
archive_format: 'zip',
});
var fs = require('fs');
fs.writeFileSync('${{github.workspace}}/nacos.zip', Buffer.from(download.data));
- run: |
unzip nacos.zip
mkdir nacos
cp -r nacos-* nacos/
ls
- uses: actions/checkout@v3
with:
repository: nacos-group/nacos-e2e.git
ref: main
path: nacos-e2e
- 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: |
mv nacos-server-*-SNAPSHOT.tar.gz nacos-e2e/cicd/build
cd nacos-e2e/cicd/build
version=${{ github.event.pull_request.number || github.ref_name }}-$(uuidgen)
mkdir versionlist
touch versionlist/"${version}-`echo ${{ matrix.java-version }} | sed -e "s/:/-/g"`"
ls versionlist/
tag=${version}-$(echo ${{ matrix.java-version }} | sed -e "s/:/-/g")
echo $tag
docker build --no-cache -f Dockerfile -t ${DOCKER_REPO}:${tag} .
docker push ${DOCKER_REPO}:${tag}
- uses: actions/upload-artifact@v3
name: Upload distribution tar
with:
name: versionlist
path: nacos-e2e/cicd/build/versionlist/*


list-version:
if: always()
name: List version
needs: [docker]
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:
if: ${{ success() }}
name: Deploy nacos
needs: [list-version,docker]
runs-on: ubuntu-latest
timeout-minutes: 60
env:
REPLICA_COUNT: 3
DATABASE: mysql
NODE_PORT: 30000
strategy:
matrix:
mode: ["cluster","standalone"]
version: ${{ fromJSON(needs.list-version.outputs.version-json) }}
steps:
- name: set nodeport
run: |
echo "::set-env name=NODE_PORT::$(expr $(expr $(expr $(expr 1 * $(expr ${{ github.run_number }} - 1)) + ${{ strategy.job-index }}) % 30000) + 30000)"
- name: set cluster params
if: ${{ matrix.mode == 'standalone' }}
run: |
echo "::set-env name=REPLICA_COUNT::1"
echo "::set-env name=DATABASE::embedded"
- uses: apache/rocketmq-test-tool@136205caa6e97f81744e30adea114dd2f09cc55e
name: Deploy nacos
with:
action: "deploy"
ask-config: "${{ secrets.ASK_CONFIG_VIRGINA }}"
test-version: "${{ matrix.version }}"
chart-git: "https://ghproxy.com/https://github.com/nacos-group/nacos-e2e.git"
chart-branch: "main"
chart-path: "./cicd/helm"
job-id: ${{ strategy.job-index }}
helm-values: |
namespace: nacos-${{ github.run_id }}-${{ strategy.job-index }}
global:
mode: ${{ matrix.mode }}
nacos:
replicaCount: ${{ env.REPLICA_COUNT }}
image:
repository: ${{ env.DOCKER_REPO }}
tag: ${{ matrix.version }}
storage:
type: ${{ env.DATABASE }}
db:
port: 3306
username: nacos
password: nacos
param: characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useSSL=false
service:
nodePort: ${{ env.NODE_PORT }}
type: ClusterIP
e2e-test:
if: ${{ success() }}
name: E2E Test
needs: [list-version, deploy]
runs-on: ubuntu-latest
timeout-minutes: 60
strategy:
matrix:
mode: ["cluster","standalone"]
version: ${{ fromJSON(needs.list-version.outputs.version-json) }}
steps:
- uses: apache/rocketmq-test-tool@136205caa6e97f81744e30adea114dd2f09cc55e
name: e2e test
with:
action: "test"
ask-config: "${{ secrets.ASK_CONFIG_VIRGINA }}"
test-version: "${{ matrix.version }}"
test-code-git: "https://github.com/nacos-group/nacos-e2e.git"
test-code-branch: "main"
test-code-path: "java/nacos-2X"
test-cmd: 'mvn clean test -B'
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 ${{ matrix.mode }}
path: testlog.txt

clean:
if: always()
name: Clean
needs: [list-version, e2e-test]
runs-on: ubuntu-latest
timeout-minutes: 60
strategy:
matrix:
mode: ["cluster","standalone"]
version: ${{ fromJSON(needs.list-version.outputs.version-json) }}
steps:
- uses: apache/rocketmq-test-tool@136205caa6e97f81744e30adea114dd2f09cc55e
name: clean
with:
action: "clean"
ask-config: "${{ secrets.ASK_CONFIG_VIRGINA }}"
test-version: "${{ matrix.version }}"
job-id: ${{ strategy.job-index }}

0 comments on commit ca6d151

Please sign in to comment.