Optimize code and improve readability #445
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: database-write-prohibition integration test | |
env: | |
sermantVersion: 1.0.0 | |
on: | |
push: | |
pull_request: | |
branches: | |
- '*' | |
paths: | |
- 'sermant-agentcore/**' | |
- 'sermant-integration-tests/database-write-prohibition-test/**' | |
- 'sermant-plugins/sermant-database-write-prohibition/**' | |
- '.github/workflows/database_write_prohibition_integration_test.yml' | |
- '.github/actions/common/database-write-prohibition/**' | |
- '.github/actions/scenarios/database-write-prohibition/**' | |
- '.github/actions/common/plugin-change-check/action.yml' | |
- '.github/actions/common/entry/action.yml' | |
- '.github/actions/common/exit/action.yml' | |
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 "enableMongodbDataBaseWriteProhibitionAction=${{env.enableMongodbDataBaseWriteProhibitionAction}}" >> $GITHUB_OUTPUT | |
echo "enableMysqlDataBaseWriteProhibitionAction=${{env.enableMysqlDataBaseWriteProhibitionAction}}" >> $GITHUB_OUTPUT | |
echo "enableOpengaussDataBaseWriteProhibitionAction=${{env.enableOpengaussDataBaseWriteProhibitionAction}}" >> $GITHUB_OUTPUT | |
echo "enableOpengaussAndPostgresqlDataBaseWriteProhibitionAction=${{env.enableOpengaussAndPostgresqlDataBaseWriteProhibitionAction}}" >> $GITHUB_OUTPUT | |
outputs: | |
enableMongodbDataBaseWriteProhibitionAction: ${{ steps.set-outputs.outputs.enableMongodbDataBaseWriteProhibitionAction }} | |
enableMysqlDataBaseWriteProhibitionAction: ${{ steps.set-outputs.outputs.enableMysqlDataBaseWriteProhibitionAction }} | |
enableOpengaussDataBaseWriteProhibitionAction: ${{ steps.set-outputs.outputs.enableOpengaussDataBaseWriteProhibitionAction }} | |
enableOpengaussAndPostgresqlDataBaseWriteProhibitionAction: ${{ steps.set-outputs.outputs.enableOpengaussAndPostgresqlDataBaseWriteProhibitionAction }} | |
download-midwares-and-cache: | |
name: download midwares and cache | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- 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 | |
build-agent-and-cache: | |
name: build agent and cache | |
runs-on: ubuntu-latest | |
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: package agent | |
run: | | |
sed -i '/sermant-backend/d' pom.xml | |
sed -i '/sermant-integration-tests/d' pom.xml | |
sed -i '/sermant-injector/d' pom.xml | |
mvn package -DskipTests -Ptest --file pom.xml | |
test-for-database-write-prohibition-mongodb: | |
name: Test for database-write-prohibition mongodb | |
runs-on: ubuntu-latest | |
if: needs.set-execution-conditions.outputs.enableMongodbDataBaseWriteProhibitionAction == 'true' | |
needs: [set-execution-conditions, build-agent-and-cache, download-midwares-and-cache] | |
strategy: | |
matrix: | |
include: | |
- mongodbClientVersion: "3.7.0" | |
- mongodbClientVersion: "3.8.2" | |
- mongodbClientVersion: "3.9.1" | |
- mongodbClientVersion: "3.10.2" | |
- mongodbClientVersion: "3.11.3" | |
- mongodbClientVersion: "3.12.14" | |
- mongodbClientVersion: "4.0.6" | |
- mongodbClientVersion: "4.1.2" | |
- mongodbClientVersion: "4.2.3" | |
- mongodbClientVersion: "4.3.4" | |
- mongodbClientVersion: "4.4.2" | |
- mongodbClientVersion: "4.5.1" | |
- mongodbClientVersion: "4.6.1" | |
- mongodbClientVersion: "4.7.2" | |
- mongodbClientVersion: "4.8.2" | |
- mongodbClientVersion: "4.9.1" | |
- mongodbClientVersion: "4.10.2" | |
- mongodbClientVersion: "4.11.1" | |
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/database-write-prohibition | |
- name: database-write-prohibition-mongodb test for mongodbClientVersion=${{ matrix.mongodbClientVersion }} | |
uses: ./.github/actions/scenarios/database-write-prohibition/mongodb | |
test-for-database-write-prohibition-mysql: | |
name: Test for database-write-prohibition mysql | |
if: needs.set-execution-conditions.outputs.enableMysqlDataBaseWriteProhibitionAction == 'true' | |
runs-on: ubuntu-latest | |
needs: [set-execution-conditions, build-agent-and-cache, download-midwares-and-cache] | |
strategy: | |
matrix: | |
include: | |
- mysqlClientVersion: "2.6.2" | |
- mysqlClientVersion: "2.7.6" | |
- mysqlClientVersion: "2.7.12" | |
- mysqlClientVersion: "3.0.6" | |
- mysqlClientVersion: "3.0.11" | |
- mysqlClientVersion: "3.1.4" | |
- mysqlClientVersion: "3.2.0" | |
- mysqlClientVersion: "3.3.3" | |
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/database-write-prohibition | |
- name: database-write-prohibition-mysql test for mysqlClientVersion=${{ matrix.mysqlClientVersion }} | |
uses: ./.github/actions/scenarios/database-write-prohibition/mysql | |
test-for-postgresql: | |
name: Test for postgresql | |
runs-on: ubuntu-latest | |
if: needs.set-execution-conditions.outputs.enableOpengaussAndPostgresqlDataBaseWriteProhibitionAction == 'true' | |
needs: [set-execution-conditions, build-agent-and-cache, download-midwares-and-cache] | |
strategy: | |
matrix: | |
include: | |
- postgresqlVersion: "9.4-1200-jdbc4" | |
- postgresqlVersion: "9.4-1203-jdbc4" | |
- postgresqlVersion: "9.4-1206-jdbc4" | |
- postgresqlVersion: "9.4-1200-jdbc41" | |
- postgresqlVersion: "9.4-1203-jdbc41" | |
- postgresqlVersion: "9.4-1206-jdbc41" | |
- postgresqlVersion: "9.4.1207" | |
- postgresqlVersion: "9.4.1210" | |
- postgresqlVersion: "9.4.1212" | |
- postgresqlVersion: "42.0.0" | |
- postgresqlVersion: "42.1.0" | |
- postgresqlVersion: "42.1.2" | |
- postgresqlVersion: "42.1.4" | |
- postgresqlVersion: "42.2.0" | |
- postgresqlVersion: "42.2.3" | |
- postgresqlVersion: "42.2.6" | |
- postgresqlVersion: "42.2.9" | |
- postgresqlVersion: "42.2.12" | |
- postgresqlVersion: "42.2.15" | |
- postgresqlVersion: "42.2.18" | |
- postgresqlVersion: "42.2.21" | |
- postgresqlVersion: "42.2.24" | |
- postgresqlVersion: "42.2.27" | |
- postgresqlVersion: "42.2.29" | |
- postgresqlVersion: "42.3.0" | |
- postgresqlVersion: "42.3.3" | |
- postgresqlVersion: "42.3.6" | |
- postgresqlVersion: "42.3.8" | |
- postgresqlVersion: "42.3.10" | |
- postgresqlVersion: "42.4.0" | |
- postgresqlVersion: "42.4.3" | |
- postgresqlVersion: "42.4.5" | |
- postgresqlVersion: "42.5.0" | |
- postgresqlVersion: "42.5.3" | |
- postgresqlVersion: "42.5.6" | |
- postgresqlVersion: "42.6.0" | |
- postgresqlVersion: "42.6.2" | |
- postgresqlVersion: "42.7.0" | |
- postgresqlVersion: "42.7.2" | |
fail-fast: false | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 100 | |
- name: set java version to environment | |
run: | | |
echo "javaVersion=8" >> $GITHUB_ENV | |
datasourcePassword=$(openssl rand -base64 16 | tr -dc 'a-zA-Z0-9' | head -c 10)A1a#$ | |
echo "datasourcePassword=$datasourcePassword" >> $GITHUB_ENV | |
- name: common operations | |
uses: ./.github/actions/common/database-write-prohibition | |
- name: database-write-prohibition test for postgresqlVersion=${{ matrix.postgresqlVersion }} | |
uses: ./.github/actions/scenarios/database-write-prohibition/postgresql/ | |
test-for-opengauss: | |
name: Test for opengauss | |
runs-on: ubuntu-latest | |
if: needs.set-execution-conditions.outputs.enableOpengaussDataBaseWriteProhibitionAction == 'true' | |
needs: [set-execution-conditions, build-agent-and-cache, download-midwares-and-cache] | |
strategy: | |
matrix: | |
include: | |
- opengaussVersion: "3.0.0" | |
- opengaussVersion: "3.0.5" | |
- opengaussVersion: "3.0.5-og" | |
- opengaussVersion: "3.1.0" | |
- opengaussVersion: "3.1.0-og" | |
- opengaussVersion: "3.1.1" | |
- opengaussVersion: "3.1.1-og" | |
fail-fast: false | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 100 | |
- name: set java version to environment | |
run: | | |
echo "javaVersion=8" >> $GITHUB_ENV | |
datasourcePassword=$(openssl rand -base64 16 | tr -dc 'a-zA-Z0-9' | head -c 10)A1a#$ | |
echo "datasourcePassword=$datasourcePassword" >> $GITHUB_ENV | |
- name: common operations | |
uses: ./.github/actions/common/database-write-prohibition | |
- name: database-write-prohibition test for opengaussVersion=${{ matrix.opengaussVersion }} | |
uses: ./.github/actions/scenarios/database-write-prohibition/opengauss/ |