Skip to content

Optimize code and improve readability #157

Optimize code and improve readability

Optimize code and improve readability #157

name: agentcore servcie integration test
env:
sermantVersion: 1.0.0
on:
push:
pull_request:
branches:
- '*'
paths:
- 'sermant-agentcore/sermant-agentcore-implement/**'
- 'sermant-agentcore/sermant-agentcore-core/**'
- 'sermant-integration-tests/xds-service-test/**'
- 'sermant-integration-tests/agentcore-test/agentcore-test-application/**'
- 'sermant-integration-tests/agentcore-test/agentcore-integration-test/**'
- 'agentcore_service_test.yml'
- '.github/actions/common/xds-service/**'
- '.github/actions/common/agentcore/**'
- '.github/actions/scenarios/xds-service/**'
- '.github/actions/scenarios/agentcore/dynamic-config/**'
- '.github/actions/common/plugin-change-check/action.yml'
- '.github/actions/common/entry/action.yml'
- '.github/actions/common/exit/action.yml'
- 'sermant-plugins/sermant-router/router-common/**'
- 'sermant-plugins/sermant-router/spring-router-plugin/**'
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-${{ github.head_ref }}
cancel-in-progress: true
jobs:
set-execution-conditions:
name: set-execution-conditions
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 100
- name: plugin-change-check
id: plugin-change-check
uses: ./.github/actions/common/plugin-change-check
- name: set-outputs
id: set-outputs
run: |
echo "enableDynamicConfigServicAction=${{env.enableDynamicConfigServicAction}}" >> $GITHUB_OUTPUT
echo "enableXdsServicAction=${{env.enableXdsServicAction}}" >> $GITHUB_OUTPUT
outputs:
enableDynamicConfigServicAction: ${{ steps.set-outputs.outputs.enableDynamicConfigServicAction }}
enableXdsServicAction: ${{ steps.set-outputs.outputs.enableXdsServicAction }}
download-midwares-and-cache:
name: download midwares and cache
runs-on: ubuntu-latest
if: needs.set-execution-conditions.outputs.enableDynamicConfigServicAction == 'true'
needs: [ set-execution-conditions ]
steps:
- uses: actions/checkout@v4
- name: cache local cse
uses: actions/cache@v4
with:
path: Local-CSE-2.1.3-linux-amd64.zip
key: ${{ runner.os }}-local-cse
restore-keys: |
${{ runner.os }}-local-cse
- name: download cse
run: |
export ROOT_PATH=$(pwd)
bash ./sermant-integration-tests/scripts/tryDownloadMidware.sh cse
- name: cache zookeeper
uses: actions/cache@v4
with:
path: apache-zookeeper-3.6.3-bin.tar.gz
key: ${{ runner.os }}-apache-zookeeper-3.6.3
restore-keys: |
${{ runner.os }}-apache-zookeeper-3.6.3
- name: download zookeeper
run: |
export ROOT_PATH=$(pwd)
bash ./sermant-integration-tests/scripts/tryDownloadMidware.sh zk
- name: cache nacos server
uses: actions/cache@v4
with:
path: nacos-server-2.1.0.tar.gz
key: ${{ runner.os }}-nacos-server-2.1.0
restore-keys: |
${{ runner.os }}-nacos-server-2.1.0
- name: download nacos
run: |
export ROOT_PATH=$(pwd)
bash ./sermant-integration-tests/scripts/tryDownloadMidware.sh nacos210
build-agent-and-cache:
name: build agent and cache
runs-on: ubuntu-latest
if: needs.set-execution-conditions.outputs.enableDynamicConfigServicAction == 'true' || needs.set-execution-conditions.outputs.enableXdsServicAction == 'true'
needs: [set-execution-conditions]
steps:
- uses: actions/checkout@v4
- name: Set up JDK 8
uses: actions/setup-java@v4
with:
java-version: '8'
distribution: 'adopt'
cache: maven
- name: cache agent
uses: actions/cache@v4
with:
path: sermant-agent-*/
key: ${{ runner.os }}-agent-${{ github.run_id }}
- name: cache xds service package
uses: actions/cache@v4
with:
path: sermant-integration-tests/xds-service-test/product/sermant-agent-*/
key: ${{ runner.os }}-xds-service-product-agent-${{ github.run_id }}
- name: package agent
run: |
sed -i '/sermant-backend/d' pom.xml
sed -i '/sermant-injector/d' pom.xml
mvn package -DskipTests -Ptest --file pom.xml
mkdir -p sermant-agent-${{ env.sermantVersion }}/agent/pluginPackage/agentcore-test-plugin/plugin
mkdir -p sermant-agent-${{ env.sermantVersion }}/agent/pluginPackage/dynamic-test-first-plugin/plugin
mkdir -p sermant-agent-${{ env.sermantVersion }}/agent/pluginPackage/dynamic-test-second-plugin/plugin
mkdir -p sermant-agent-${{ env.sermantVersion }}/agent/pluginPackage/dynamic-test-third-plugin/plugin
cp ./sermant-integration-tests/agentcore-test/agentcore-test-plugin/target/agentcore-test-plugin-1.0.0.jar sermant-agent-${{ env.sermantVersion }}/agent/pluginPackage/agentcore-test-plugin/plugin/
cp -r ./sermant-integration-tests/agentcore-test/config sermant-agent-${{ env.sermantVersion }}/agent/pluginPackage/agentcore-test-plugin/
cp ./sermant-integration-tests/agentcore-test/dynamic-test-first-plugin/target/dynamic-test-first-plugin-1.0.0.jar sermant-agent-${{ env.sermantVersion }}/agent/pluginPackage/dynamic-test-first-plugin/plugin/
cp ./sermant-integration-tests/agentcore-test/dynamic-test-second-plugin/target/dynamic-test-second-plugin-1.0.0.jar sermant-agent-${{ env.sermantVersion }}/agent/pluginPackage/dynamic-test-second-plugin/plugin/
cp ./sermant-integration-tests/agentcore-test/dynamic-test-third-plugin/target/dynamic-test-third-plugin-1.0.0.jar sermant-agent-${{ env.sermantVersion }}/agent/pluginPackage/dynamic-test-third-plugin/plugin/
cp ./sermant-integration-tests/agentcore-test/agentcore-test-application/target/agentcore-test-application-1.0.0-jar-with-dependencies.jar sermant-agent-${{ env.sermantVersion }}/agent/
sed -i '/plugins:/a \ - agentcore-test-plugin' sermant-agent-${{ env.sermantVersion }}/agent/config/plugins.yaml
test-for-agentcore-dynamic-config:
name: Test for agentcore dynamic config
runs-on: ubuntu-latest
if: needs.set-execution-conditions.outputs.enableDynamicConfigServicAction == 'true'
needs: [ set-execution-conditions, build-agent-and-cache, download-midwares-and-cache ]
strategy:
matrix:
include:
- serviceAddress: "127.0.0.1:8848"
dynamicConfigType: "NACOS"
- serviceAddress: "127.0.0.1:2181"
dynamicConfigType: "ZOOKEEPER"
fail-fast: false
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 100
- name: set java version to environment
run: |
echo "javaVersion=8" >> $GITHUB_ENV
- name: common operations
uses: ./.github/actions/common/agentcore
- name: test dynamic config for ${{ matrix.dynamicConfigType }}
uses: ./.github/actions/scenarios/agentcore/dynamic-config
test-for-xds-service-discovery-onlysermant:
name: Test for xds service discovery with only sermant
runs-on: ubuntu-latest
if: needs.set-execution-conditions.outputs.enableXdsServicAction == 'true'
needs: [set-execution-conditions, build-agent-and-cache]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 100
- name: set java version to environment
run: |
echo "javaVersion=8" >> $GITHUB_ENV
- name: xds common operation
uses: ./.github/actions/common/xds-service
- name: xds service discovery
uses: ./.github/actions/scenarios/xds-service/xds-service-discovery/sermant-only
test-for-xds-service-discovery-with-server-envoy:
name: Test for xds service discovery with spring-server using envoy
runs-on: ubuntu-latest
if: needs.set-execution-conditions.outputs.enableXdsServicAction == 'true'
needs: [set-execution-conditions, build-agent-and-cache]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 100
- name: set java version to environment
run: |
echo "javaVersion=8" >> $GITHUB_ENV
- name: xds common operation
uses: ./.github/actions/common/xds-service
- name: xds service discovery
uses: ./.github/actions/scenarios/xds-service/xds-service-discovery/server-envoy
test-for-xds-service-discovery-with-client-envoy:
name: Test for xds service discovery with spring-client using enovy
runs-on: ubuntu-latest
if: needs.set-execution-conditions.outputs.enableXdsServicAction == 'true'
needs: [set-execution-conditions, build-agent-and-cache]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 100
- name: set java version to environment
run: |
echo "javaVersion=8" >> $GITHUB_ENV
- name: xds common operation
uses: ./.github/actions/common/xds-service
- name: xds service discovery
uses: ./.github/actions/scenarios/xds-service/xds-service-discovery/client-envoy
test-for-xds-router-lb:
name: Test for xds router and lb with router plugin
runs-on: ubuntu-latest
if: needs.set-execution-conditions.outputs.enableXdsServicAction == 'true'
needs: [set-execution-conditions, build-agent-and-cache]
strategy:
matrix:
include:
- springBootVersion: "2.0.2.RELEASE"
snakeyamlVersion: "1.19"
springCloudVersion: "Finchley.RELEASE"
httpClientVersion: "4.4"
okHttp2Version: "2.2.0"
okHttp3Version: "3.5.0"
httpAsyncClientVersion: "4.0.1"
- springBootVersion: "2.1.0.RELEASE"
snakeyamlVersion: "1.23"
springCloudVersion: "Greenwich.RELEASE"
httpClientVersion: "4.4.1"
okHttp2Version: "2.3.0"
okHttp3Version: "3.9.1"
httpAsyncClientVersion: "4.0.2"
- springBootVersion: "2.2.0.RELEASE"
snakeyamlVersion: "1.25"
springCloudVersion: "Hoxton.RELEASE"
httpClientVersion: "4.5"
okHttp2Version: "2.4.0"
okHttp3Version: "3.12.13"
httpAsyncClientVersion: "4.1"
- springBootVersion: "2.3.0.RELEASE"
snakeyamlVersion: "1.26"
springCloudVersion: "Hoxton.RELEASE"
httpClientVersion: "4.5.3"
okHttp2Version: "2.5.0"
okHttp3Version: "3.14.9"
httpAsyncClientVersion: "4.1.1"
- springBootVersion: "2.4.0"
snakeyamlVersion: "1.27"
springCloudVersion: "2020.0.0"
httpClientVersion: "4.5.7"
okHttp2Version: "2.6.0"
okHttp3Version: "4.2.2"
httpAsyncClientVersion: "4.1.2"
- springBootVersion: "2.6.2"
snakeyamlVersion: "1.29"
springCloudVersion: "2021.0.0"
httpClientVersion: "4.5.10"
okHttp2Version: "2.7.3"
okHttp3Version: "4.7.2"
httpAsyncClientVersion: "4.1.3"
- springBootVersion: "2.7.17"
snakeyamlVersion: "1.30"
springCloudVersion: "2021.0.3"
httpClientVersion: "4.5.13"
okHttp2Version: "2.7.5"
okHttp3Version: "4.12.0"
httpAsyncClientVersion: "4.1.5"
fail-fast: false
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 100
- name: set java version to environment
run: |
echo "javaVersion=8" >> $GITHUB_ENV
- name: xds common operation
uses: ./.github/actions/common/xds-service
- name: xds router and lb test
uses: ./.github/actions/scenarios/xds-service/xds-router-lb