From 25df9d76c91972de4a28669d7bf6fc314960b18e Mon Sep 17 00:00:00 2001 From: jandroav Date: Fri, 31 May 2024 09:47:01 +0200 Subject: [PATCH 01/37] =?UTF-8?q?=E2=9C=A8=20(aws-weekly.yml):=20Add=20AWS?= =?UTF-8?q?=20Weekly=20Cloud=20Database=20Test=20Execution=20workflow=20fo?= =?UTF-8?q?r=20testing=20Cloud=20Databases=20with=20test-harness=20using?= =?UTF-8?q?=20Terraform=20Action=20=F0=9F=94=A7=20(aws-weekly.yml):=20Conf?= =?UTF-8?q?igure=20workflow=20to=20run=20every=20Sunday=20at=206:00=20AM?= =?UTF-8?q?=20and=20allow=20manual=20triggers=20with=20specified=20test=20?= =?UTF-8?q?classes=20and=20databases=20to=20start=20up=20=F0=9F=9A=80=20(a?= =?UTF-8?q?ws-weekly.yml):=20Implement=20jobs=20for=20setup,=20deploying?= =?UTF-8?q?=20ephemeral=20cloud=20infrastructure,=20initializing=20MySQL?= =?UTF-8?q?=20databases,=20and=20running=20tests=20on=20various=20database?= =?UTF-8?q?=20platforms=20and=20versions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ✨ Add support for running tests on different database platforms and versions using Maven 🔧 Update test run configurations to include database platform, version, username, password, and URL 🔧 Add support for running tests on AWS Aurora database platform 🔧 Include logic to archive test results for AWS RDS databases 🔧 Implement logic to destroy ephemeral cloud infrastructure after testing phase --- .github/workflows/aws-weekly.yml | 291 +++++++++++++++++++++++++++++++ 1 file changed, 291 insertions(+) create mode 100644 .github/workflows/aws-weekly.yml diff --git a/.github/workflows/aws-weekly.yml b/.github/workflows/aws-weekly.yml new file mode 100644 index 000000000..fd5c8976f --- /dev/null +++ b/.github/workflows/aws-weekly.yml @@ -0,0 +1,291 @@ +# Terraform Action to test Cloud Databases with test-harness + +name: AWS Weekly Cloud Database Test Execution +concurrency: aws-run +on: + # Triggers the workflow on a schedule for the main branch. Also allows for manual triggers + # Execute every sunday at 6:00 AM + schedule: + - cron: '0 6 * * 0' + workflow_dispatch: + inputs: + testClasses: + type: choice + description: Test Suite or test class to run + options: + - LiquibaseHarnessSuiteTest + - FoundationalHarnessSuiteTest + - AdvancedHarnessSuiteTest + - ChangeObjectTests + - ChangeDataTests + - SnapshotObjectTests + - GenerateChangelogTest + - FoundationalTest + databases: + description: Databases to start up. Comma separated list of "name:version" + required: true + default: "[\"postgresql:12\",\"postgresql:13\",\"postgresql:14\",\"oracle:aws_19\",\"mariadb:aws_10.6\",\"mysql:aws\",\"mysql:aurora\",\"mssql:2019\",\"postgresql:aurora\"]" + +jobs: + setup: + name: Setup + runs-on: ubuntu-latest + outputs: + databases: ${{ github.event.inputs.databases || '["postgresql:12","postgresql:13","postgresql:14","oracle:aws_19","mariadb:aws_10.6","mysql:aws","mysql:aurora","mssql:2019","postgresql:aurora"]' }} + testClasses: ${{ inputs.testClasses || 'LiquibaseHarnessSuiteTest' }} + steps: + - name: Checkout + uses: actions/checkout@v4 + + deploy-ephemeral-cloud-infra: + uses: liquibase/build-logic/.github/workflows/ephemeral-cloud-infra.yml@DAT-17834 + secrets: inherit + with: + deploy: true + aws_test_harness: true + + init-mysql: + runs-on: ubuntu-latest + needs: [deploy-ephemeral-cloud-infra] + container: + image: liquibase/liquibase:latest + env: + LIQUIBASE_PRO_LICENSE_KEY: ${{ secrets.LICENSE_KEY }} + strategy: + fail-fast: false + matrix: + include: + - database: mysql + version: aws + - database: mysql + version: aurora + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v4 + with: + role-to-assume: ${{ secrets.AWS_DEV_GITHUB_OIDC_ROLE_ARN_BUILD_LOGIC }} + aws-region: us-east-1 + + - name: Get AWS secrets + uses: aws-actions/aws-secretsmanager-get-secrets@v2 + with: + secret-ids: | + TH_MYSQLURL_8_0, /testautomation/db_details/aws_mysql_jdbc${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} + TH_AURORA_MYSQLURL, /testautomation/db_details/aurora_mysql_jdbc${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} + TH_ORACLEURL_19, /testautomation/db_details/aws_oracle_19_jdbc${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} + TH_PGRESURL_12, /testautomation/db_details/aws_postgresql_12_jdbc${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} + TH_PGRESURL_13, /testautomation/db_details/aws_postgresql_13_jdbc${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} + TH_PGRESURL_14, /testautomation/db_details/aws_postgresql_14_jdbc${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} + TH_MARIADBURL_10_6, /testautomation/db_details/aws_mariadb_jdbc${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} + TH_MSSQLURL, /testautomation/db_details/aws_mssql_jdbc${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} + TH_AURORA_POSTGRESQLURL, /testautomation/db_details/aurora_postgresql_jdbc${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} + + #This additional init step is required because of mysql driver issue on GH actions + - name: Install Dependencies + run: lpm update && lpm add mysql + + - name: Clean AWS MySQL Database + uses: liquibase-github-actions/drop-all@v4.25.1 + if: ${{ matrix.version == 'aws' }} + with: + url: "${{ env.TH_MYSQLURL_8_0 }}" + username: "${{secrets.TH_DB_ADMIN}}" + password: "${{secrets.TH_DB_PASSWD}}" + licenseKey: "${{secrets.LICENSE_KEY}}" + + - name: Init Database + if: ${{ matrix.version == 'aws' }} + run: liquibase --classpath="src/test/resources/init-changelogs/aws" --changeLogFile="${{ matrix.database }}.sql" --username="${{ secrets.TH_DB_ADMIN }}" --password="${{ secrets.TH_DB_PASSWD }}" --url="${{ env.TH_MYSQLURL_8_0 }}" update + + - name: Clean Aurora MySQL Database + uses: liquibase-github-actions/drop-all@v4.25.1 + if: ${{ matrix.version == 'aurora' }} + with: + url: "${{ env.TH_AURORA_MYSQLURL }}" + username: "${{secrets.TH_DB_ADMIN}}" + password: "${{secrets.TH_DB_PASSWD}}" + licenseKey: "${{secrets.LICENSE_KEY}}" + + - name: Init Database + if: ${{ matrix.version == 'aurora' }} + run: liquibase --classpath="src/test/resources/init-changelogs/aws" --changeLogFile="${{ matrix.database }}.sql" --username="${{ secrets.TH_DB_ADMIN }}" --password="${{ secrets.TH_DB_PASSWD }}" --url="${{ env.TH_AURORA_MYSQLURL }}" update + + test: + needs: [init-mysql, setup] + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + database: ${{ fromJson(needs.setup.outputs.databases) }} + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Configure Test + id: setup + uses: actions/github-script@v7.0.1 + with: + script: | + let splitValues = "${{ matrix.database }}".split(":") + core.setOutput("databasePlatform", splitValues[0]); + core.setOutput("databaseVersion", splitValues[1]); + + - uses: liquibase-github-actions/drop-all@v4.25.1 + if: ${{ steps.setup.outputs.databasePlatform == 'oracle' }} + with: + url: "${{ env.TH_ORACLEURL_19 }}" + username: "${{secrets.TH_DB_ADMIN}}" + password: "${{secrets.TH_DB_PASSWD}}" + licenseKey: "${{secrets.LICENSE_KEY}}" + + - uses: liquibase/liquibase-github-action@v7 + if: ${{ steps.setup.outputs.databasePlatform == 'oracle' }} + with: + operation: "update" + classpath: "src/test/resources/init-changelogs/aws" + changeLogFile: "oracle.sql" + username: "${{secrets.TH_DB_ADMIN}}" + password: "${{secrets.TH_DB_PASSWD}}" + url: "${{ env.TH_ORACLEURL_19 }}" + + - uses: liquibase-github-actions/drop-all@v4.25.1 + if: ${{ steps.setup.outputs.databasePlatform == 'postgresql' && steps.setup.outputs.databaseVersion != 'aurora' }} + with: + url: "${{ env[format('TH_PGRESURL_{0}', steps.setup.outputs.databaseVersion)] }}" + username: "${{secrets.TH_DB_ADMIN}}" + password: "${{secrets.TH_DB_PASSWD}}" + licenseKey: "${{secrets.LICENSE_KEY}}" + + - uses: liquibase/liquibase-github-action@v7 + if: ${{ steps.setup.outputs.databasePlatform == 'postgresql' && steps.setup.outputs.databaseVersion != 'aurora' }} + with: + operation: "update" + classpath: "src/test/resources/init-changelogs/aws" + changeLogFile: "postgresql.sql" + username: "${{secrets.TH_DB_ADMIN}}" + password: "${{secrets.TH_DB_PASSWD}}" + url: "${{ env[format('TH_PGRESURL_{0}', steps.setup.outputs.databaseVersion)] }}" + + - uses: liquibase-github-actions/drop-all@v4.25.1 + if: ${{ steps.setup.outputs.databasePlatform == 'mariadb' }} + with: + url: "${{ env.TH_MARIADBURL_10_6 }}" + username: "${{secrets.TH_DB_ADMIN}}" + password: "${{secrets.TH_DB_PASSWD}}" + licenseKey: "${{secrets.LICENSE_KEY}}" + + - uses: liquibase/liquibase-github-action@v7 + if: ${{ steps.setup.outputs.databasePlatform == 'mariadb' }} + with: + operation: "update" + classpath: "src/test/resources/init-changelogs/aws" + changeLogFile: "mariadb.sql" + username: "${{secrets.TH_DB_ADMIN}}" + password: "${{secrets.TH_DB_PASSWD}}" + url: "${{ env.TH_MARIADBURL_10_6 }}" + + - uses: liquibase-github-actions/drop-all@v4.25.1 + if: ${{ steps.setup.outputs.databasePlatform == 'mssql' }} + with: + url: "${{ env.TH_MSSQLURL }}" + username: "${{secrets.TH_DB_ADMIN}}" + password: "${{secrets.TH_DB_PASSWD}}" + licenseKey: "${{secrets.LICENSE_KEY}}" + + - uses: liquibase/liquibase-github-action@v7 + if: ${{ steps.setup.outputs.databasePlatform == 'mssql' }} + with: + operation: "update" + classpath: "src/test/resources/init-changelogs/aws" + changeLogFile: "mssql.sql" + username: "${{secrets.TH_DB_ADMIN}}" + password: "${{secrets.TH_DB_PASSWD}}" + url: "${{ env.TH_MSSQLURL }}" + + - uses: liquibase-github-actions/drop-all@v4.25.1 + if: ${{ steps.setup.outputs.databasePlatform == 'postgresql' && steps.setup.outputs.databaseVersion == 'aurora' }} + with: + url: "${{ env.TH_AURORA_POSTGRESQLURL }}" + username: "${{secrets.TH_DB_ADMIN}}" + password: "${{secrets.TH_DB_PASSWD}}" + licenseKey: "${{secrets.LICENSE_KEY}}" + + - uses: liquibase/liquibase-github-action@v7 + if: ${{ steps.setup.outputs.databasePlatform == 'postgresql' && steps.setup.outputs.databaseVersion == 'aurora' }} + with: + operation: "update" + classpath: "src/test/resources/init-changelogs/aws" + changeLogFile: "postgresql.sql" + username: "${{secrets.TH_DB_ADMIN}}" + password: "${{secrets.TH_DB_PASSWD}}" + url: "${{ env.TH_AURORA_POSTGRESQLURL }}" + + - name: Cache local Maven repository + uses: actions/cache@v3 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} + restore-keys: | + ${{ runner.os }}-maven- + + - name: AWS RDS ${{ steps.setup.outputs.databasePlatform }}-${{ steps.setup.outputs.databaseVersion }} Test Run + if: ${{ steps.setup.outputs.databasePlatform == 'postgresql' && steps.setup.outputs.databaseVersion != 'aurora' }} + env: + LIQUIBASE_PRO_LICENSE_KEY: ${{ secrets.LICENSE_KEY }} + run: mvn -Dtest=${{ needs.setup.outputs.testClasses }} -DconfigFile=/harness-config-cloud.yml -DdbName=${{ steps.setup.outputs.databasePlatform }} -DdbVersion=${{ steps.setup.outputs.databaseVersion }} -Dprefix=aws -DdbUsername=${{secrets.TH_DB_ADMIN}} -DdbPassword=${{secrets.TH_DB_PASSWD}} -DdbUrl='${{ env[format('TH_PGRESURL_{0}', steps.setup.outputs.databaseVersion)] }}' test + + - name: AWS RDS ${{ steps.setup.outputs.databasePlatform }}-${{ steps.setup.outputs.databaseVersion }} Test Run + if: ${{ steps.setup.outputs.databasePlatform == 'oracle' }} + env: + LIQUIBASE_PRO_LICENSE_KEY: ${{ secrets.LICENSE_KEY }} + run: mvn -Dtest=${{ needs.setup.outputs.testClasses }} -DconfigFile=/harness-config-cloud.yml -DdbName=${{ steps.setup.outputs.databasePlatform }} -DdbVersion=${{ steps.setup.outputs.databaseVersion }} -DdbUsername=${{secrets.TH_DB_ADMIN}} -DdbPassword=${{secrets.TH_DB_PASSWD}} -DdbUrl='${{ env.TH_ORACLEURL_19 }}' test + + - name: AWS RDS ${{ steps.setup.outputs.databasePlatform }}-${{ steps.setup.outputs.databaseVersion }} Test Run + if: ${{ steps.setup.outputs.databasePlatform == 'mariadb' }} + env: + LIQUIBASE_PRO_LICENSE_KEY: ${{ secrets.LICENSE_KEY }} + run: mvn -Dtest=${{ needs.setup.outputs.testClasses }} -DconfigFile=/harness-config-cloud.yml -DdbName=${{ steps.setup.outputs.databasePlatform }} -DdbVersion=${{ steps.setup.outputs.databaseVersion }} -DdbUsername=${{secrets.TH_DB_ADMIN}} -DdbPassword=${{secrets.TH_DB_PASSWD}} -DdbUrl='${{ env.TH_MARIADBURL_10_6 }}' test + + - name: AWS RDS ${{ steps.setup.outputs.databasePlatform }}-${{ steps.setup.outputs.databaseVersion }} Test Run + if: ${{ steps.setup.outputs.databasePlatform == 'mysql' && steps.setup.outputs.databaseVersion == 'aws' }} + env: + LIQUIBASE_PRO_LICENSE_KEY: ${{ secrets.LICENSE_KEY }} + run: mvn -Dtest=${{ needs.setup.outputs.testClasses }} -DconfigFile=/harness-config-cloud.yml -DdbName=${{ steps.setup.outputs.databasePlatform }} -DdbVersion=${{ steps.setup.outputs.databaseVersion }} -DdbUsername=${{secrets.TH_DB_ADMIN}} -DdbPassword=${{secrets.TH_DB_PASSWD}} -DdbUrl='${{ env.TH_MYSQLURL_8_0 }}' test + + - name: AWS RDS ${{ steps.setup.outputs.databasePlatform }}-${{ steps.setup.outputs.databaseVersion }} Test Run + if: ${{ steps.setup.outputs.databasePlatform == 'mssql' }} + env: + LIQUIBASE_PRO_LICENSE_KEY: ${{ secrets.LICENSE_KEY }} + run: mvn -Dtest=${{ needs.setup.outputs.testClasses }} -DconfigFile=/harness-config-cloud.yml -DdbName=${{ steps.setup.outputs.databasePlatform }} -DdbVersion=${{ steps.setup.outputs.databaseVersion }} -DdbUsername=${{secrets.TH_DB_ADMIN}} -DdbPassword=${{secrets.TH_DB_PASSWD}} -DdbUrl='${{ env.TH_MSSQLURL }}' test + + - name: AWS Aurora ${{ steps.setup.outputs.databasePlatform }} Test Run + if: ${{ steps.setup.outputs.databasePlatform == 'mysql' && steps.setup.outputs.databaseVersion == 'aurora' }} + env: + LIQUIBASE_PRO_LICENSE_KEY: ${{ secrets.LICENSE_KEY }} + run: mvn -Dtest=${{ needs.setup.outputs.testClasses }} -DconfigFile=/harness-config-cloud.yml -DdbName=${{ steps.setup.outputs.databasePlatform }} -DdbVersion=${{ steps.setup.outputs.databaseVersion }} -DdbUsername=${{secrets.TH_DB_ADMIN}} -DdbPassword=${{secrets.TH_DB_PASSWD}} -DdbUrl='${{ env.TH_AURORA_MYSQLURL }}' test + + - name: AWS Aurora ${{ steps.setup.outputs.databasePlatform }} Test Run + if: ${{ steps.setup.outputs.databasePlatform == 'postgresql' && steps.setup.outputs.databaseVersion == 'aurora' }} + env: + LIQUIBASE_PRO_LICENSE_KEY: ${{ secrets.LICENSE_KEY }} + run: mvn -Dtest=${{ needs.setup.outputs.testClasses }} -DconfigFile=/harness-config-cloud.yml -DdbName=${{ steps.setup.outputs.databasePlatform }} -DdbVersion=13 -Dprefix=aurora -DdbUsername=${{secrets.TH_DB_ADMIN}} -DdbPassword=${{secrets.TH_DB_PASSWD}} -DdbUrl='${{ env.TH_AURORA_POSTGRESQLURL }}' test + + - name: Archive AWS RDS ${{ steps.setup.outputs.databasePlatform }}-${{ steps.setup.outputs.databaseVersion }} Test Results + uses: actions/upload-artifact@v4 + with: + name: aws-rds-${{ steps.setup.outputs.databasePlatform }}-${{ steps.setup.outputs.databaseVersion }}-test-results + path: build/spock-reports + + destroy-ephemeral-cloud-infra: + if: always() + needs: [ deploy-ephemeral-cloud-infra, test ] + uses: liquibase/build-logic/.github/workflows/ephemeral-cloud-infra.yml@DAT-17834 + secrets: inherit + with: + destroy: true + stack_id: ${{ needs.deploy-ephemeral-cloud-infra.outputs.stack_id }} + aws_test_harness: true \ No newline at end of file From 1a7b0e8f56116f807542a082e8410ec58a512d91 Mon Sep 17 00:00:00 2001 From: jandroav Date: Fri, 31 May 2024 10:44:30 +0200 Subject: [PATCH 02/37] =?UTF-8?q?=F0=9F=94=A7=20(aws-weekly.yml):=20Update?= =?UTF-8?q?=20schedule=20to=20execute=20workflow=20every=20Sunday=20at=204?= =?UTF-8?q?:00=20AM=20instead=20of=206:00=20AM=20=F0=9F=94=A7=20(aws-weekl?= =?UTF-8?q?y.yml):=20Refactor=20workflow=20to=20include=20support=20for=20?= =?UTF-8?q?various=20database=20types=20in=20the=20test=20execution=20proc?= =?UTF-8?q?ess?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/aws-weekly.yml | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/.github/workflows/aws-weekly.yml b/.github/workflows/aws-weekly.yml index fd5c8976f..3561d2b59 100644 --- a/.github/workflows/aws-weekly.yml +++ b/.github/workflows/aws-weekly.yml @@ -4,9 +4,9 @@ name: AWS Weekly Cloud Database Test Execution concurrency: aws-run on: # Triggers the workflow on a schedule for the main branch. Also allows for manual triggers - # Execute every sunday at 6:00 AM + # Execute every sunday at 4:00 AM schedule: - - cron: '0 6 * * 0' + - cron: '0 4 * * 0' workflow_dispatch: inputs: testClasses: @@ -42,7 +42,14 @@ jobs: secrets: inherit with: deploy: true - aws_test_harness: true + aws_postgresql: ${{ contains(inputs.databases, 'postgresql') }} + aws_oracle: ${{ contains(inputs.databases, 'oracle') }} + aws_mariadb: ${{ contains(inputs.databases, 'mariadb') }} + aws_aurora_mysql: ${{ contains(inputs.databases, 'mysql:aurora') }} + aws_mssql: ${{ contains(inputs.databases, 'mssql') }} + aws_aurora_postgres: ${{ contains(inputs.databases, 'postgresql:aurora') }} + + init-mysql: runs-on: ubuntu-latest @@ -288,4 +295,9 @@ jobs: with: destroy: true stack_id: ${{ needs.deploy-ephemeral-cloud-infra.outputs.stack_id }} - aws_test_harness: true \ No newline at end of file + aws_postgresql: ${{ contains(inputs.databases, 'postgresql') }} + aws_oracle: ${{ contains(inputs.databases, 'oracle') }} + aws_mariadb: ${{ contains(inputs.databases, 'mariadb') }} + aws_aurora_mysql: ${{ contains(inputs.databases, 'mysql:aurora') }} + aws_mssql: ${{ contains(inputs.databases, 'mssql') }} + aws_aurora_postgres: ${{ contains(inputs.databases, 'postgresql:aurora') }} \ No newline at end of file From 5bac9b1dbae4e437bcd394f80873dce277de49ae Mon Sep 17 00:00:00 2001 From: jandroav Date: Fri, 31 May 2024 11:29:35 +0200 Subject: [PATCH 03/37] =?UTF-8?q?=E2=9C=A8=20(aws-weekly.yml):=20add=20sup?= =?UTF-8?q?port=20for=20AWS=20MySQL=20database=20option=20in=20the=20workf?= =?UTF-8?q?low=20configuration.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/aws-weekly.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/aws-weekly.yml b/.github/workflows/aws-weekly.yml index 3561d2b59..79c9cd5c0 100644 --- a/.github/workflows/aws-weekly.yml +++ b/.github/workflows/aws-weekly.yml @@ -48,6 +48,7 @@ jobs: aws_aurora_mysql: ${{ contains(inputs.databases, 'mysql:aurora') }} aws_mssql: ${{ contains(inputs.databases, 'mssql') }} aws_aurora_postgres: ${{ contains(inputs.databases, 'postgresql:aurora') }} + aws_mysql: ${{ contains(inputs.databases, 'mysql:aws') }} @@ -300,4 +301,6 @@ jobs: aws_mariadb: ${{ contains(inputs.databases, 'mariadb') }} aws_aurora_mysql: ${{ contains(inputs.databases, 'mysql:aurora') }} aws_mssql: ${{ contains(inputs.databases, 'mssql') }} - aws_aurora_postgres: ${{ contains(inputs.databases, 'postgresql:aurora') }} \ No newline at end of file + aws_aurora_postgres: ${{ contains(inputs.databases, 'postgresql:aurora') }} + aws_mysql: ${{ contains(inputs.databases, 'mysql:aws') }} + \ No newline at end of file From eaa73fbfc5a242454ed47616d2c600c5728100db Mon Sep 17 00:00:00 2001 From: jandroav Date: Fri, 31 May 2024 11:41:56 +0200 Subject: [PATCH 04/37] =?UTF-8?q?=F0=9F=94=A7=20(aws-weekly.yml):=20Update?= =?UTF-8?q?=20condition=20for=20aws=5Fpostgresql=20to=20exclude=20'postgre?= =?UTF-8?q?sql:aurora'=20and=20include=20'postgresql'=20for=20deployment?= =?UTF-8?q?=20decision-making.=20Remove=20unnecessary=20whitespace=20at=20?= =?UTF-8?q?the=20end=20of=20the=20file.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/aws-weekly.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/aws-weekly.yml b/.github/workflows/aws-weekly.yml index 79c9cd5c0..dbeef8dee 100644 --- a/.github/workflows/aws-weekly.yml +++ b/.github/workflows/aws-weekly.yml @@ -42,7 +42,7 @@ jobs: secrets: inherit with: deploy: true - aws_postgresql: ${{ contains(inputs.databases, 'postgresql') }} + aws_postgresql: ${{ !contains(inputs.databases, 'postgresql:aurora') && contains(inputs.databases, 'postgresql') }} aws_oracle: ${{ contains(inputs.databases, 'oracle') }} aws_mariadb: ${{ contains(inputs.databases, 'mariadb') }} aws_aurora_mysql: ${{ contains(inputs.databases, 'mysql:aurora') }} @@ -50,8 +50,6 @@ jobs: aws_aurora_postgres: ${{ contains(inputs.databases, 'postgresql:aurora') }} aws_mysql: ${{ contains(inputs.databases, 'mysql:aws') }} - - init-mysql: runs-on: ubuntu-latest needs: [deploy-ephemeral-cloud-infra] @@ -303,4 +301,3 @@ jobs: aws_mssql: ${{ contains(inputs.databases, 'mssql') }} aws_aurora_postgres: ${{ contains(inputs.databases, 'postgresql:aurora') }} aws_mysql: ${{ contains(inputs.databases, 'mysql:aws') }} - \ No newline at end of file From 33e3166596935982943d51962b4d2b8cb3053591 Mon Sep 17 00:00:00 2001 From: jandroav Date: Fri, 31 May 2024 11:42:13 +0200 Subject: [PATCH 05/37] =?UTF-8?q?=F0=9F=90=9B=20(aws-weekly.yml):=20fix=20?= =?UTF-8?q?condition=20for=20aws=5Fpostgresql=20to=20correctly=20check=20f?= =?UTF-8?q?or=20'postgresql'=20database=20type=20and=20exclude=20'postgres?= =?UTF-8?q?ql:aurora'=20from=20the=20check?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/aws-weekly.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/aws-weekly.yml b/.github/workflows/aws-weekly.yml index dbeef8dee..eb5133a98 100644 --- a/.github/workflows/aws-weekly.yml +++ b/.github/workflows/aws-weekly.yml @@ -294,7 +294,7 @@ jobs: with: destroy: true stack_id: ${{ needs.deploy-ephemeral-cloud-infra.outputs.stack_id }} - aws_postgresql: ${{ contains(inputs.databases, 'postgresql') }} + aws_postgresql: ${{ !contains(inputs.databases, 'postgresql:aurora') && contains(inputs.databases, 'postgresql') }} aws_oracle: ${{ contains(inputs.databases, 'oracle') }} aws_mariadb: ${{ contains(inputs.databases, 'mariadb') }} aws_aurora_mysql: ${{ contains(inputs.databases, 'mysql:aurora') }} From b416e8b5d2a3c065a75f5ff41f3276b4577df3bb Mon Sep 17 00:00:00 2001 From: jandroav Date: Fri, 31 May 2024 12:48:49 +0200 Subject: [PATCH 06/37] =?UTF-8?q?=F0=9F=94=A7=20(aws-weekly.yml):=20add=20?= =?UTF-8?q?permissions=20for=20contents=20and=20id-token=20to=20improve=20?= =?UTF-8?q?security=20and=20access=20control=20in=20the=20workflow=20job.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/aws-weekly.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/aws-weekly.yml b/.github/workflows/aws-weekly.yml index eb5133a98..2da354923 100644 --- a/.github/workflows/aws-weekly.yml +++ b/.github/workflows/aws-weekly.yml @@ -53,6 +53,9 @@ jobs: init-mysql: runs-on: ubuntu-latest needs: [deploy-ephemeral-cloud-infra] + permissions: + contents: read + id-token: write container: image: liquibase/liquibase:latest env: From b4eba1c917008cf8e664d32812e3bfeae4483151 Mon Sep 17 00:00:00 2001 From: jandroav Date: Fri, 31 May 2024 14:07:51 +0200 Subject: [PATCH 07/37] =?UTF-8?q?=F0=9F=93=9D=20(aws-weekly.yml):=20remove?= =?UTF-8?q?=20unnecessary=20concurrency=20key=20from=20workflow=20configur?= =?UTF-8?q?ation=20to=20improve=20readability=20and=20maintainability?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/aws-weekly.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/aws-weekly.yml b/.github/workflows/aws-weekly.yml index 2da354923..c316f025c 100644 --- a/.github/workflows/aws-weekly.yml +++ b/.github/workflows/aws-weekly.yml @@ -1,7 +1,6 @@ # Terraform Action to test Cloud Databases with test-harness name: AWS Weekly Cloud Database Test Execution -concurrency: aws-run on: # Triggers the workflow on a schedule for the main branch. Also allows for manual triggers # Execute every sunday at 4:00 AM From 72c3137a659d590a441321c8200c6128716a246b Mon Sep 17 00:00:00 2001 From: jandroav Date: Fri, 31 May 2024 14:31:36 +0200 Subject: [PATCH 08/37] =?UTF-8?q?=F0=9F=94=A7=20(aws-weekly.yml):=20Update?= =?UTF-8?q?=20secret-ids=20format=20for=20mysql=20and=20aurora=20database?= =?UTF-8?q?=20connections=20to=20include=20correct=20resource=20id=20suffi?= =?UTF-8?q?x=20=F0=9F=94=A7=20(aws-weekly.yml):=20Remove=20unnecessary=20s?= =?UTF-8?q?ecret-ids=20for=20other=20database=20connections=20to=20streaml?= =?UTF-8?q?ine=20the=20workflow=20and=20improve=20readability?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/aws-weekly.yml | 73 +++++++++++++++++++++++++++----- 1 file changed, 63 insertions(+), 10 deletions(-) diff --git a/.github/workflows/aws-weekly.yml b/.github/workflows/aws-weekly.yml index c316f025c..5c5bad7d9 100644 --- a/.github/workflows/aws-weekly.yml +++ b/.github/workflows/aws-weekly.yml @@ -51,7 +51,6 @@ jobs: init-mysql: runs-on: ubuntu-latest - needs: [deploy-ephemeral-cloud-infra] permissions: contents: read id-token: write @@ -81,15 +80,8 @@ jobs: uses: aws-actions/aws-secretsmanager-get-secrets@v2 with: secret-ids: | - TH_MYSQLURL_8_0, /testautomation/db_details/aws_mysql_jdbc${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} - TH_AURORA_MYSQLURL, /testautomation/db_details/aurora_mysql_jdbc${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} - TH_ORACLEURL_19, /testautomation/db_details/aws_oracle_19_jdbc${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} - TH_PGRESURL_12, /testautomation/db_details/aws_postgresql_12_jdbc${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} - TH_PGRESURL_13, /testautomation/db_details/aws_postgresql_13_jdbc${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} - TH_PGRESURL_14, /testautomation/db_details/aws_postgresql_14_jdbc${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} - TH_MARIADBURL_10_6, /testautomation/db_details/aws_mariadb_jdbc${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} - TH_MSSQLURL, /testautomation/db_details/aws_mssql_jdbc${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} - TH_AURORA_POSTGRESQLURL, /testautomation/db_details/aurora_postgresql_jdbc${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} + TH_MYSQLURL_8_0, /testautomation/db_details/aws_mysql_jdbc_${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} + TH_AURORA_MYSQLURL, /testautomation/db_details/aurora_mysql_jdbc_${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} #This additional init step is required because of mysql driver issue on GH actions - name: Install Dependencies @@ -123,6 +115,9 @@ jobs: test: needs: [init-mysql, setup] + permissions: + contents: read + id-token: write runs-on: ubuntu-latest strategy: fail-fast: false @@ -133,6 +128,64 @@ jobs: - name: Checkout uses: actions/checkout@v4 + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v4 + with: + role-to-assume: ${{ secrets.AWS_DEV_GITHUB_OIDC_ROLE_ARN_BUILD_LOGIC }} + aws-region: us-east-1 + + - name: Get AWS secrets + if: ${{ steps.setup.outputs.databasePlatform == 'mysql' && steps.setup.outputs.databaseVersion == 'aws' }} + uses: aws-actions/aws-secretsmanager-get-secrets@v2 + with: + secret-ids: | + TH_MYSQLURL_8_0, /testautomation/db_details/aws_mysql_jdbc_${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} + + - name: Get AWS secrets + if: ${{ steps.setup.outputs.databasePlatform == 'mysql' && steps.setup.outputs.databaseVersion == 'aurora' }} + uses: aws-actions/aws-secretsmanager-get-secrets@v2 + with: + secret-ids: | + TH_AURORA_MYSQLURL, /testautomation/db_details/aurora_mysql_jdbc_${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} + + + - name: Get AWS secrets + if: ${{ steps.setup.outputs.databasePlatform == 'oracle' }} + uses: aws-actions/aws-secretsmanager-get-secrets@v2 + with: + secret-ids: | + TH_ORACLEURL_19, /testautomation/db_details/aws_oracle_19_jdbc_${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} + + - name: Get AWS secrets + if: ${{ steps.setup.outputs.databasePlatform == 'postgresql' && steps.setup.outputs.databaseVersion != 'aurora' }} + uses: aws-actions/aws-secretsmanager-get-secrets@v2 + with: + secret-ids: | + TH_PGRESURL_12, /testautomation/db_details/aws_postgresql_12_jdbc_${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} + TH_PGRESURL_13, /testautomation/db_details/aws_postgresql_13_jdbc_${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} + TH_PGRESURL_14, /testautomation/db_details/aws_postgresql_14_jdbc_${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} + + - name: Get AWS secrets + if: ${{ steps.setup.outputs.databasePlatform == 'mariadb' }} + uses: aws-actions/aws-secretsmanager-get-secrets@v2 + with: + secret-ids: | + TH_MARIADBURL_10_6, /testautomation/db_details/aws_mariadb_jdbc_${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} + + - name: Get AWS secrets + if: ${{ steps.setup.outputs.databasePlatform == 'mssql' }} + uses: aws-actions/aws-secretsmanager-get-secrets@v2 + with: + secret-ids: | + TH_MSSQLURL, /testautomation/db_details/aws_mssql_jdbc_${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} + + - name: Get AWS secrets + if: ${{ steps.setup.outputs.databasePlatform == 'postgresql' && steps.setup.outputs.databaseVersion == 'aurora' }} + uses: aws-actions/aws-secretsmanager-get-secrets@v2 + with: + secret-ids: | + TH_AURORA_POSTGRESQLURL, /testautomation/db_details/aurora_postgresql_jdbc_${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} + - name: Configure Test id: setup uses: actions/github-script@v7.0.1 From 63b3876e01a6207ed9c1249193987c45c461bc15 Mon Sep 17 00:00:00 2001 From: jandroav Date: Fri, 31 May 2024 14:46:20 +0200 Subject: [PATCH 09/37] =?UTF-8?q?=F0=9F=94=A7=20(aws-weekly.yml):=20add=20?= =?UTF-8?q?support=20for=20fetching=20different=20AWS=20secrets=20based=20?= =?UTF-8?q?on=20the=20matrix=20version=20(aws=20or=20aurora)=20to=20improv?= =?UTF-8?q?e=20flexibility=20and=20security=20in=20accessing=20database=20?= =?UTF-8?q?credentials.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/aws-weekly.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/aws-weekly.yml b/.github/workflows/aws-weekly.yml index 5c5bad7d9..9f33e1af4 100644 --- a/.github/workflows/aws-weekly.yml +++ b/.github/workflows/aws-weekly.yml @@ -51,6 +51,7 @@ jobs: init-mysql: runs-on: ubuntu-latest + needs: [deploy-ephemeral-cloud-infra] permissions: contents: read id-token: write @@ -77,10 +78,17 @@ jobs: aws-region: us-east-1 - name: Get AWS secrets + if: ${{ matrix.version == 'aws' }} uses: aws-actions/aws-secretsmanager-get-secrets@v2 with: secret-ids: | TH_MYSQLURL_8_0, /testautomation/db_details/aws_mysql_jdbc_${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} + + - name: Get AWS secrets + if: ${{ matrix.version == 'aurora' }} + uses: aws-actions/aws-secretsmanager-get-secrets@v2 + with: + secret-ids: | TH_AURORA_MYSQLURL, /testautomation/db_details/aurora_mysql_jdbc_${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} #This additional init step is required because of mysql driver issue on GH actions From c4ed610c8618cfaa0ef92b46c22527472207c453 Mon Sep 17 00:00:00 2001 From: jandroav Date: Fri, 31 May 2024 15:05:01 +0200 Subject: [PATCH 10/37] =?UTF-8?q?=F0=9F=94=A7=20(aws-weekly.yml):=20Update?= =?UTF-8?q?=20the=20reference=20to=20the=20ephemeral-cloud-infra.yml=20wor?= =?UTF-8?q?kflow=20to=20use=20the=20master=20branch=20instead=20of=20a=20s?= =?UTF-8?q?pecific=20branch=20for=20consistency=20and=20stability.=20Also,?= =?UTF-8?q?=20adjust=20the=20conditions=20for=20the=20aws=5Fpostgresql=20v?= =?UTF-8?q?ariable=20to=20include=20versions=2012,=2013,=20and=2014=20for?= =?UTF-8?q?=20better=20compatibility.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/aws-weekly.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/aws-weekly.yml b/.github/workflows/aws-weekly.yml index 9f33e1af4..675ae2b41 100644 --- a/.github/workflows/aws-weekly.yml +++ b/.github/workflows/aws-weekly.yml @@ -37,11 +37,11 @@ jobs: uses: actions/checkout@v4 deploy-ephemeral-cloud-infra: - uses: liquibase/build-logic/.github/workflows/ephemeral-cloud-infra.yml@DAT-17834 + uses: liquibase/build-logic/.github/workflows/ephemeral-cloud-infra.yml@master secrets: inherit with: deploy: true - aws_postgresql: ${{ !contains(inputs.databases, 'postgresql:aurora') && contains(inputs.databases, 'postgresql') }} + aws_postgresql: ${{ contains(inputs.databases, 'postgresql:12') || contains(inputs.databases, 'postgresql:13') || contains(inputs.databases, 'postgresql:14')}} aws_oracle: ${{ contains(inputs.databases, 'oracle') }} aws_mariadb: ${{ contains(inputs.databases, 'mariadb') }} aws_aurora_mysql: ${{ contains(inputs.databases, 'mysql:aurora') }} @@ -352,12 +352,12 @@ jobs: destroy-ephemeral-cloud-infra: if: always() needs: [ deploy-ephemeral-cloud-infra, test ] - uses: liquibase/build-logic/.github/workflows/ephemeral-cloud-infra.yml@DAT-17834 + uses: liquibase/build-logic/.github/workflows/ephemeral-cloud-infra.yml@master secrets: inherit with: destroy: true stack_id: ${{ needs.deploy-ephemeral-cloud-infra.outputs.stack_id }} - aws_postgresql: ${{ !contains(inputs.databases, 'postgresql:aurora') && contains(inputs.databases, 'postgresql') }} + aws_postgresql: ${{ contains(inputs.databases, 'postgresql:12') || contains(inputs.databases, 'postgresql:13') || contains(inputs.databases, 'postgresql:14')}} aws_oracle: ${{ contains(inputs.databases, 'oracle') }} aws_mariadb: ${{ contains(inputs.databases, 'mariadb') }} aws_aurora_mysql: ${{ contains(inputs.databases, 'mysql:aurora') }} From 9b95019b921bf121d4dc4dae412e45b709c63c07 Mon Sep 17 00:00:00 2001 From: jandroav Date: Fri, 31 May 2024 16:27:23 +0200 Subject: [PATCH 11/37] =?UTF-8?q?=F0=9F=94=A7=20(aws-weekly.yml):=20Update?= =?UTF-8?q?=20the=20version=20of=20ephemeral-cloud-infra.yml=20to=20DAT-17?= =?UTF-8?q?834=20for=20both=20deploy=20and=20destroy=20jobs=20to=20align?= =?UTF-8?q?=20with=20the=20changes=20made=20in=20the=20referenced=20file.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/aws-weekly.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/aws-weekly.yml b/.github/workflows/aws-weekly.yml index 675ae2b41..4a84c4c59 100644 --- a/.github/workflows/aws-weekly.yml +++ b/.github/workflows/aws-weekly.yml @@ -37,7 +37,7 @@ jobs: uses: actions/checkout@v4 deploy-ephemeral-cloud-infra: - uses: liquibase/build-logic/.github/workflows/ephemeral-cloud-infra.yml@master + uses: liquibase/build-logic/.github/workflows/ephemeral-cloud-infra.yml@DAT-17834 secrets: inherit with: deploy: true @@ -352,7 +352,7 @@ jobs: destroy-ephemeral-cloud-infra: if: always() needs: [ deploy-ephemeral-cloud-infra, test ] - uses: liquibase/build-logic/.github/workflows/ephemeral-cloud-infra.yml@master + uses: liquibase/build-logic/.github/workflows/ephemeral-cloud-infra.yml@DAT-17834 secrets: inherit with: destroy: true From 06c2255710ed8fda9fe5cff78b4a1a606298cfa5 Mon Sep 17 00:00:00 2001 From: jandroav Date: Fri, 31 May 2024 16:54:29 +0200 Subject: [PATCH 12/37] =?UTF-8?q?=F0=9F=94=A7=20(aws-weekly.yml):=20Update?= =?UTF-8?q?=20conditional=20statements=20to=20fetch=20AWS=20secrets=20base?= =?UTF-8?q?d=20on=20database=20platform=20and=20version=20selected=20durin?= =?UTF-8?q?g=20setup.=20Adjust=20database=20cleanup=20and=20initialization?= =?UTF-8?q?=20steps=20accordingly=20for=20MySQL=20databases=20on=20AWS=20a?= =?UTF-8?q?nd=20Aurora.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/aws-weekly.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/aws-weekly.yml b/.github/workflows/aws-weekly.yml index 4a84c4c59..ac5f8c3a8 100644 --- a/.github/workflows/aws-weekly.yml +++ b/.github/workflows/aws-weekly.yml @@ -78,14 +78,14 @@ jobs: aws-region: us-east-1 - name: Get AWS secrets - if: ${{ matrix.version == 'aws' }} + if: ${{ steps.setup.outputs.databasePlatform == 'mysql' && steps.setup.outputs.databaseVersion == 'aws' }} uses: aws-actions/aws-secretsmanager-get-secrets@v2 with: secret-ids: | TH_MYSQLURL_8_0, /testautomation/db_details/aws_mysql_jdbc_${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} - name: Get AWS secrets - if: ${{ matrix.version == 'aurora' }} + if: ${{ steps.setup.outputs.databasePlatform == 'mysql' && steps.setup.outputs.databaseVersion == 'aurora' }} uses: aws-actions/aws-secretsmanager-get-secrets@v2 with: secret-ids: | @@ -97,7 +97,7 @@ jobs: - name: Clean AWS MySQL Database uses: liquibase-github-actions/drop-all@v4.25.1 - if: ${{ matrix.version == 'aws' }} + if: ${{ steps.setup.outputs.databasePlatform == 'mysql' && steps.setup.outputs.databaseVersion == 'aws' }} with: url: "${{ env.TH_MYSQLURL_8_0 }}" username: "${{secrets.TH_DB_ADMIN}}" @@ -105,12 +105,12 @@ jobs: licenseKey: "${{secrets.LICENSE_KEY}}" - name: Init Database - if: ${{ matrix.version == 'aws' }} + if: ${{ steps.setup.outputs.databasePlatform == 'mysql' && steps.setup.outputs.databaseVersion == 'aws' }} run: liquibase --classpath="src/test/resources/init-changelogs/aws" --changeLogFile="${{ matrix.database }}.sql" --username="${{ secrets.TH_DB_ADMIN }}" --password="${{ secrets.TH_DB_PASSWD }}" --url="${{ env.TH_MYSQLURL_8_0 }}" update - name: Clean Aurora MySQL Database uses: liquibase-github-actions/drop-all@v4.25.1 - if: ${{ matrix.version == 'aurora' }} + if: ${{ steps.setup.outputs.databasePlatform == 'mysql' && steps.setup.outputs.databaseVersion == 'aurora' }} with: url: "${{ env.TH_AURORA_MYSQLURL }}" username: "${{secrets.TH_DB_ADMIN}}" @@ -118,7 +118,7 @@ jobs: licenseKey: "${{secrets.LICENSE_KEY}}" - name: Init Database - if: ${{ matrix.version == 'aurora' }} + if: ${{ steps.setup.outputs.databasePlatform == 'mysql' && steps.setup.outputs.databaseVersion == 'aurora' }} run: liquibase --classpath="src/test/resources/init-changelogs/aws" --changeLogFile="${{ matrix.database }}.sql" --username="${{ secrets.TH_DB_ADMIN }}" --password="${{ secrets.TH_DB_PASSWD }}" --url="${{ env.TH_AURORA_MYSQLURL }}" update test: From 5175d985e57f10215f2e03b4215876f85ac197ce Mon Sep 17 00:00:00 2001 From: jandroav Date: Sat, 1 Jun 2024 06:54:10 +0200 Subject: [PATCH 13/37] =?UTF-8?q?=F0=9F=94=A7=20(aws-weekly.yml):=20Update?= =?UTF-8?q?=20workflow=20to=20use=20'needs'=20instead=20of=20'steps'=20to?= =?UTF-8?q?=20access=20outputs=20for=20databasePlatform=20and=20databaseVe?= =?UTF-8?q?rsion=20to=20ensure=20correct=20conditional=20execution=20based?= =?UTF-8?q?=20on=20dependencies.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 🔧 (aws-weekly.yml): Update references to 'steps.setup.outputs' to 'needs.setup.outputs' to correctly access outputs from previous job steps. --- .github/workflows/aws-weekly.yml | 96 ++++++++++++++++---------------- 1 file changed, 48 insertions(+), 48 deletions(-) diff --git a/.github/workflows/aws-weekly.yml b/.github/workflows/aws-weekly.yml index ac5f8c3a8..05c208d5c 100644 --- a/.github/workflows/aws-weekly.yml +++ b/.github/workflows/aws-weekly.yml @@ -78,14 +78,14 @@ jobs: aws-region: us-east-1 - name: Get AWS secrets - if: ${{ steps.setup.outputs.databasePlatform == 'mysql' && steps.setup.outputs.databaseVersion == 'aws' }} + if: ${{ needs.setup.outputs.databasePlatform == 'mysql' && needs.setup.outputs.databaseVersion == 'aws' }} uses: aws-actions/aws-secretsmanager-get-secrets@v2 with: secret-ids: | TH_MYSQLURL_8_0, /testautomation/db_details/aws_mysql_jdbc_${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} - name: Get AWS secrets - if: ${{ steps.setup.outputs.databasePlatform == 'mysql' && steps.setup.outputs.databaseVersion == 'aurora' }} + if: ${{ needs.setup.outputs.databasePlatform == 'mysql' && needs.setup.outputs.databaseVersion == 'aurora' }} uses: aws-actions/aws-secretsmanager-get-secrets@v2 with: secret-ids: | @@ -97,7 +97,7 @@ jobs: - name: Clean AWS MySQL Database uses: liquibase-github-actions/drop-all@v4.25.1 - if: ${{ steps.setup.outputs.databasePlatform == 'mysql' && steps.setup.outputs.databaseVersion == 'aws' }} + if: ${{ needs.setup.outputs.databasePlatform == 'mysql' && needs.setup.outputs.databaseVersion == 'aws' }} with: url: "${{ env.TH_MYSQLURL_8_0 }}" username: "${{secrets.TH_DB_ADMIN}}" @@ -105,12 +105,12 @@ jobs: licenseKey: "${{secrets.LICENSE_KEY}}" - name: Init Database - if: ${{ steps.setup.outputs.databasePlatform == 'mysql' && steps.setup.outputs.databaseVersion == 'aws' }} + if: ${{ needs.setup.outputs.databasePlatform == 'mysql' && needs.setup.outputs.databaseVersion == 'aws' }} run: liquibase --classpath="src/test/resources/init-changelogs/aws" --changeLogFile="${{ matrix.database }}.sql" --username="${{ secrets.TH_DB_ADMIN }}" --password="${{ secrets.TH_DB_PASSWD }}" --url="${{ env.TH_MYSQLURL_8_0 }}" update - name: Clean Aurora MySQL Database uses: liquibase-github-actions/drop-all@v4.25.1 - if: ${{ steps.setup.outputs.databasePlatform == 'mysql' && steps.setup.outputs.databaseVersion == 'aurora' }} + if: ${{ needs.setup.outputs.databasePlatform == 'mysql' && needs.setup.outputs.databaseVersion == 'aurora' }} with: url: "${{ env.TH_AURORA_MYSQLURL }}" username: "${{secrets.TH_DB_ADMIN}}" @@ -118,7 +118,7 @@ jobs: licenseKey: "${{secrets.LICENSE_KEY}}" - name: Init Database - if: ${{ steps.setup.outputs.databasePlatform == 'mysql' && steps.setup.outputs.databaseVersion == 'aurora' }} + if: ${{ needs.setup.outputs.databasePlatform == 'mysql' && needs.setup.outputs.databaseVersion == 'aurora' }} run: liquibase --classpath="src/test/resources/init-changelogs/aws" --changeLogFile="${{ matrix.database }}.sql" --username="${{ secrets.TH_DB_ADMIN }}" --password="${{ secrets.TH_DB_PASSWD }}" --url="${{ env.TH_AURORA_MYSQLURL }}" update test: @@ -143,14 +143,14 @@ jobs: aws-region: us-east-1 - name: Get AWS secrets - if: ${{ steps.setup.outputs.databasePlatform == 'mysql' && steps.setup.outputs.databaseVersion == 'aws' }} + if: ${{ needs.setup.outputs.databasePlatform == 'mysql' && needs.setup.outputs.databaseVersion == 'aws' }} uses: aws-actions/aws-secretsmanager-get-secrets@v2 with: secret-ids: | TH_MYSQLURL_8_0, /testautomation/db_details/aws_mysql_jdbc_${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} - name: Get AWS secrets - if: ${{ steps.setup.outputs.databasePlatform == 'mysql' && steps.setup.outputs.databaseVersion == 'aurora' }} + if: ${{ needs.setup.outputs.databasePlatform == 'mysql' && needs.setup.outputs.databaseVersion == 'aurora' }} uses: aws-actions/aws-secretsmanager-get-secrets@v2 with: secret-ids: | @@ -158,14 +158,14 @@ jobs: - name: Get AWS secrets - if: ${{ steps.setup.outputs.databasePlatform == 'oracle' }} + if: ${{ needs.setup.outputs.databasePlatform == 'oracle' }} uses: aws-actions/aws-secretsmanager-get-secrets@v2 with: secret-ids: | TH_ORACLEURL_19, /testautomation/db_details/aws_oracle_19_jdbc_${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} - name: Get AWS secrets - if: ${{ steps.setup.outputs.databasePlatform == 'postgresql' && steps.setup.outputs.databaseVersion != 'aurora' }} + if: ${{ needs.setup.outputs.databasePlatform == 'postgresql' && needs.setup.outputs.databaseVersion != 'aurora' }} uses: aws-actions/aws-secretsmanager-get-secrets@v2 with: secret-ids: | @@ -174,21 +174,21 @@ jobs: TH_PGRESURL_14, /testautomation/db_details/aws_postgresql_14_jdbc_${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} - name: Get AWS secrets - if: ${{ steps.setup.outputs.databasePlatform == 'mariadb' }} + if: ${{ needs.setup.outputs.databasePlatform == 'mariadb' }} uses: aws-actions/aws-secretsmanager-get-secrets@v2 with: secret-ids: | TH_MARIADBURL_10_6, /testautomation/db_details/aws_mariadb_jdbc_${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} - name: Get AWS secrets - if: ${{ steps.setup.outputs.databasePlatform == 'mssql' }} + if: ${{ needs.setup.outputs.databasePlatform == 'mssql' }} uses: aws-actions/aws-secretsmanager-get-secrets@v2 with: secret-ids: | TH_MSSQLURL, /testautomation/db_details/aws_mssql_jdbc_${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} - name: Get AWS secrets - if: ${{ steps.setup.outputs.databasePlatform == 'postgresql' && steps.setup.outputs.databaseVersion == 'aurora' }} + if: ${{ needs.setup.outputs.databasePlatform == 'postgresql' && needs.setup.outputs.databaseVersion == 'aurora' }} uses: aws-actions/aws-secretsmanager-get-secrets@v2 with: secret-ids: | @@ -204,7 +204,7 @@ jobs: core.setOutput("databaseVersion", splitValues[1]); - uses: liquibase-github-actions/drop-all@v4.25.1 - if: ${{ steps.setup.outputs.databasePlatform == 'oracle' }} + if: ${{ needs.setup.outputs.databasePlatform == 'oracle' }} with: url: "${{ env.TH_ORACLEURL_19 }}" username: "${{secrets.TH_DB_ADMIN}}" @@ -212,7 +212,7 @@ jobs: licenseKey: "${{secrets.LICENSE_KEY}}" - uses: liquibase/liquibase-github-action@v7 - if: ${{ steps.setup.outputs.databasePlatform == 'oracle' }} + if: ${{ needs.setup.outputs.databasePlatform == 'oracle' }} with: operation: "update" classpath: "src/test/resources/init-changelogs/aws" @@ -222,25 +222,25 @@ jobs: url: "${{ env.TH_ORACLEURL_19 }}" - uses: liquibase-github-actions/drop-all@v4.25.1 - if: ${{ steps.setup.outputs.databasePlatform == 'postgresql' && steps.setup.outputs.databaseVersion != 'aurora' }} + if: ${{ needs.setup.outputs.databasePlatform == 'postgresql' && needs.setup.outputs.databaseVersion != 'aurora' }} with: - url: "${{ env[format('TH_PGRESURL_{0}', steps.setup.outputs.databaseVersion)] }}" + url: "${{ env[format('TH_PGRESURL_{0}', needs.setup.outputs.databaseVersion)] }}" username: "${{secrets.TH_DB_ADMIN}}" password: "${{secrets.TH_DB_PASSWD}}" licenseKey: "${{secrets.LICENSE_KEY}}" - uses: liquibase/liquibase-github-action@v7 - if: ${{ steps.setup.outputs.databasePlatform == 'postgresql' && steps.setup.outputs.databaseVersion != 'aurora' }} + if: ${{ needs.setup.outputs.databasePlatform == 'postgresql' && needs.setup.outputs.databaseVersion != 'aurora' }} with: operation: "update" classpath: "src/test/resources/init-changelogs/aws" changeLogFile: "postgresql.sql" username: "${{secrets.TH_DB_ADMIN}}" password: "${{secrets.TH_DB_PASSWD}}" - url: "${{ env[format('TH_PGRESURL_{0}', steps.setup.outputs.databaseVersion)] }}" + url: "${{ env[format('TH_PGRESURL_{0}', needs.setup.outputs.databaseVersion)] }}" - uses: liquibase-github-actions/drop-all@v4.25.1 - if: ${{ steps.setup.outputs.databasePlatform == 'mariadb' }} + if: ${{ needs.setup.outputs.databasePlatform == 'mariadb' }} with: url: "${{ env.TH_MARIADBURL_10_6 }}" username: "${{secrets.TH_DB_ADMIN}}" @@ -248,7 +248,7 @@ jobs: licenseKey: "${{secrets.LICENSE_KEY}}" - uses: liquibase/liquibase-github-action@v7 - if: ${{ steps.setup.outputs.databasePlatform == 'mariadb' }} + if: ${{ needs.setup.outputs.databasePlatform == 'mariadb' }} with: operation: "update" classpath: "src/test/resources/init-changelogs/aws" @@ -258,7 +258,7 @@ jobs: url: "${{ env.TH_MARIADBURL_10_6 }}" - uses: liquibase-github-actions/drop-all@v4.25.1 - if: ${{ steps.setup.outputs.databasePlatform == 'mssql' }} + if: ${{ needs.setup.outputs.databasePlatform == 'mssql' }} with: url: "${{ env.TH_MSSQLURL }}" username: "${{secrets.TH_DB_ADMIN}}" @@ -266,7 +266,7 @@ jobs: licenseKey: "${{secrets.LICENSE_KEY}}" - uses: liquibase/liquibase-github-action@v7 - if: ${{ steps.setup.outputs.databasePlatform == 'mssql' }} + if: ${{ needs.setup.outputs.databasePlatform == 'mssql' }} with: operation: "update" classpath: "src/test/resources/init-changelogs/aws" @@ -276,7 +276,7 @@ jobs: url: "${{ env.TH_MSSQLURL }}" - uses: liquibase-github-actions/drop-all@v4.25.1 - if: ${{ steps.setup.outputs.databasePlatform == 'postgresql' && steps.setup.outputs.databaseVersion == 'aurora' }} + if: ${{ needs.setup.outputs.databasePlatform == 'postgresql' && needs.setup.outputs.databaseVersion == 'aurora' }} with: url: "${{ env.TH_AURORA_POSTGRESQLURL }}" username: "${{secrets.TH_DB_ADMIN}}" @@ -284,7 +284,7 @@ jobs: licenseKey: "${{secrets.LICENSE_KEY}}" - uses: liquibase/liquibase-github-action@v7 - if: ${{ steps.setup.outputs.databasePlatform == 'postgresql' && steps.setup.outputs.databaseVersion == 'aurora' }} + if: ${{ needs.setup.outputs.databasePlatform == 'postgresql' && needs.setup.outputs.databaseVersion == 'aurora' }} with: operation: "update" classpath: "src/test/resources/init-changelogs/aws" @@ -301,52 +301,52 @@ jobs: restore-keys: | ${{ runner.os }}-maven- - - name: AWS RDS ${{ steps.setup.outputs.databasePlatform }}-${{ steps.setup.outputs.databaseVersion }} Test Run - if: ${{ steps.setup.outputs.databasePlatform == 'postgresql' && steps.setup.outputs.databaseVersion != 'aurora' }} + - name: AWS RDS ${{ needs.setup.outputs.databasePlatform }}-${{ needs.setup.outputs.databaseVersion }} Test Run + if: ${{ needs.setup.outputs.databasePlatform == 'postgresql' && needs.setup.outputs.databaseVersion != 'aurora' }} env: LIQUIBASE_PRO_LICENSE_KEY: ${{ secrets.LICENSE_KEY }} - run: mvn -Dtest=${{ needs.setup.outputs.testClasses }} -DconfigFile=/harness-config-cloud.yml -DdbName=${{ steps.setup.outputs.databasePlatform }} -DdbVersion=${{ steps.setup.outputs.databaseVersion }} -Dprefix=aws -DdbUsername=${{secrets.TH_DB_ADMIN}} -DdbPassword=${{secrets.TH_DB_PASSWD}} -DdbUrl='${{ env[format('TH_PGRESURL_{0}', steps.setup.outputs.databaseVersion)] }}' test + run: mvn -Dtest=${{ needs.setup.outputs.testClasses }} -DconfigFile=/harness-config-cloud.yml -DdbName=${{ needs.setup.outputs.databasePlatform }} -DdbVersion=${{ needs.setup.outputs.databaseVersion }} -Dprefix=aws -DdbUsername=${{secrets.TH_DB_ADMIN}} -DdbPassword=${{secrets.TH_DB_PASSWD}} -DdbUrl='${{ env[format('TH_PGRESURL_{0}', needs.setup.outputs.databaseVersion)] }}' test - - name: AWS RDS ${{ steps.setup.outputs.databasePlatform }}-${{ steps.setup.outputs.databaseVersion }} Test Run - if: ${{ steps.setup.outputs.databasePlatform == 'oracle' }} + - name: AWS RDS ${{ needs.setup.outputs.databasePlatform }}-${{ needs.setup.outputs.databaseVersion }} Test Run + if: ${{ needs.setup.outputs.databasePlatform == 'oracle' }} env: LIQUIBASE_PRO_LICENSE_KEY: ${{ secrets.LICENSE_KEY }} - run: mvn -Dtest=${{ needs.setup.outputs.testClasses }} -DconfigFile=/harness-config-cloud.yml -DdbName=${{ steps.setup.outputs.databasePlatform }} -DdbVersion=${{ steps.setup.outputs.databaseVersion }} -DdbUsername=${{secrets.TH_DB_ADMIN}} -DdbPassword=${{secrets.TH_DB_PASSWD}} -DdbUrl='${{ env.TH_ORACLEURL_19 }}' test + run: mvn -Dtest=${{ needs.setup.outputs.testClasses }} -DconfigFile=/harness-config-cloud.yml -DdbName=${{ needs.setup.outputs.databasePlatform }} -DdbVersion=${{ needs.setup.outputs.databaseVersion }} -DdbUsername=${{secrets.TH_DB_ADMIN}} -DdbPassword=${{secrets.TH_DB_PASSWD}} -DdbUrl='${{ env.TH_ORACLEURL_19 }}' test - - name: AWS RDS ${{ steps.setup.outputs.databasePlatform }}-${{ steps.setup.outputs.databaseVersion }} Test Run - if: ${{ steps.setup.outputs.databasePlatform == 'mariadb' }} + - name: AWS RDS ${{ needs.setup.outputs.databasePlatform }}-${{ needs.setup.outputs.databaseVersion }} Test Run + if: ${{ needs.setup.outputs.databasePlatform == 'mariadb' }} env: LIQUIBASE_PRO_LICENSE_KEY: ${{ secrets.LICENSE_KEY }} - run: mvn -Dtest=${{ needs.setup.outputs.testClasses }} -DconfigFile=/harness-config-cloud.yml -DdbName=${{ steps.setup.outputs.databasePlatform }} -DdbVersion=${{ steps.setup.outputs.databaseVersion }} -DdbUsername=${{secrets.TH_DB_ADMIN}} -DdbPassword=${{secrets.TH_DB_PASSWD}} -DdbUrl='${{ env.TH_MARIADBURL_10_6 }}' test + run: mvn -Dtest=${{ needs.setup.outputs.testClasses }} -DconfigFile=/harness-config-cloud.yml -DdbName=${{ needs.setup.outputs.databasePlatform }} -DdbVersion=${{ needs.setup.outputs.databaseVersion }} -DdbUsername=${{secrets.TH_DB_ADMIN}} -DdbPassword=${{secrets.TH_DB_PASSWD}} -DdbUrl='${{ env.TH_MARIADBURL_10_6 }}' test - - name: AWS RDS ${{ steps.setup.outputs.databasePlatform }}-${{ steps.setup.outputs.databaseVersion }} Test Run - if: ${{ steps.setup.outputs.databasePlatform == 'mysql' && steps.setup.outputs.databaseVersion == 'aws' }} + - name: AWS RDS ${{ needs.setup.outputs.databasePlatform }}-${{ needs.setup.outputs.databaseVersion }} Test Run + if: ${{ needs.setup.outputs.databasePlatform == 'mysql' && needs.setup.outputs.databaseVersion == 'aws' }} env: LIQUIBASE_PRO_LICENSE_KEY: ${{ secrets.LICENSE_KEY }} - run: mvn -Dtest=${{ needs.setup.outputs.testClasses }} -DconfigFile=/harness-config-cloud.yml -DdbName=${{ steps.setup.outputs.databasePlatform }} -DdbVersion=${{ steps.setup.outputs.databaseVersion }} -DdbUsername=${{secrets.TH_DB_ADMIN}} -DdbPassword=${{secrets.TH_DB_PASSWD}} -DdbUrl='${{ env.TH_MYSQLURL_8_0 }}' test + run: mvn -Dtest=${{ needs.setup.outputs.testClasses }} -DconfigFile=/harness-config-cloud.yml -DdbName=${{ needs.setup.outputs.databasePlatform }} -DdbVersion=${{ needs.setup.outputs.databaseVersion }} -DdbUsername=${{secrets.TH_DB_ADMIN}} -DdbPassword=${{secrets.TH_DB_PASSWD}} -DdbUrl='${{ env.TH_MYSQLURL_8_0 }}' test - - name: AWS RDS ${{ steps.setup.outputs.databasePlatform }}-${{ steps.setup.outputs.databaseVersion }} Test Run - if: ${{ steps.setup.outputs.databasePlatform == 'mssql' }} + - name: AWS RDS ${{ needs.setup.outputs.databasePlatform }}-${{ needs.setup.outputs.databaseVersion }} Test Run + if: ${{ needs.setup.outputs.databasePlatform == 'mssql' }} env: LIQUIBASE_PRO_LICENSE_KEY: ${{ secrets.LICENSE_KEY }} - run: mvn -Dtest=${{ needs.setup.outputs.testClasses }} -DconfigFile=/harness-config-cloud.yml -DdbName=${{ steps.setup.outputs.databasePlatform }} -DdbVersion=${{ steps.setup.outputs.databaseVersion }} -DdbUsername=${{secrets.TH_DB_ADMIN}} -DdbPassword=${{secrets.TH_DB_PASSWD}} -DdbUrl='${{ env.TH_MSSQLURL }}' test + run: mvn -Dtest=${{ needs.setup.outputs.testClasses }} -DconfigFile=/harness-config-cloud.yml -DdbName=${{ needs.setup.outputs.databasePlatform }} -DdbVersion=${{ needs.setup.outputs.databaseVersion }} -DdbUsername=${{secrets.TH_DB_ADMIN}} -DdbPassword=${{secrets.TH_DB_PASSWD}} -DdbUrl='${{ env.TH_MSSQLURL }}' test - - name: AWS Aurora ${{ steps.setup.outputs.databasePlatform }} Test Run - if: ${{ steps.setup.outputs.databasePlatform == 'mysql' && steps.setup.outputs.databaseVersion == 'aurora' }} + - name: AWS Aurora ${{ needs.setup.outputs.databasePlatform }} Test Run + if: ${{ needs.setup.outputs.databasePlatform == 'mysql' && needs.setup.outputs.databaseVersion == 'aurora' }} env: LIQUIBASE_PRO_LICENSE_KEY: ${{ secrets.LICENSE_KEY }} - run: mvn -Dtest=${{ needs.setup.outputs.testClasses }} -DconfigFile=/harness-config-cloud.yml -DdbName=${{ steps.setup.outputs.databasePlatform }} -DdbVersion=${{ steps.setup.outputs.databaseVersion }} -DdbUsername=${{secrets.TH_DB_ADMIN}} -DdbPassword=${{secrets.TH_DB_PASSWD}} -DdbUrl='${{ env.TH_AURORA_MYSQLURL }}' test + run: mvn -Dtest=${{ needs.setup.outputs.testClasses }} -DconfigFile=/harness-config-cloud.yml -DdbName=${{ needs.setup.outputs.databasePlatform }} -DdbVersion=${{ needs.setup.outputs.databaseVersion }} -DdbUsername=${{secrets.TH_DB_ADMIN}} -DdbPassword=${{secrets.TH_DB_PASSWD}} -DdbUrl='${{ env.TH_AURORA_MYSQLURL }}' test - - name: AWS Aurora ${{ steps.setup.outputs.databasePlatform }} Test Run - if: ${{ steps.setup.outputs.databasePlatform == 'postgresql' && steps.setup.outputs.databaseVersion == 'aurora' }} + - name: AWS Aurora ${{ needs.setup.outputs.databasePlatform }} Test Run + if: ${{ needs.setup.outputs.databasePlatform == 'postgresql' && needs.setup.outputs.databaseVersion == 'aurora' }} env: LIQUIBASE_PRO_LICENSE_KEY: ${{ secrets.LICENSE_KEY }} - run: mvn -Dtest=${{ needs.setup.outputs.testClasses }} -DconfigFile=/harness-config-cloud.yml -DdbName=${{ steps.setup.outputs.databasePlatform }} -DdbVersion=13 -Dprefix=aurora -DdbUsername=${{secrets.TH_DB_ADMIN}} -DdbPassword=${{secrets.TH_DB_PASSWD}} -DdbUrl='${{ env.TH_AURORA_POSTGRESQLURL }}' test + run: mvn -Dtest=${{ needs.setup.outputs.testClasses }} -DconfigFile=/harness-config-cloud.yml -DdbName=${{ needs.setup.outputs.databasePlatform }} -DdbVersion=13 -Dprefix=aurora -DdbUsername=${{secrets.TH_DB_ADMIN}} -DdbPassword=${{secrets.TH_DB_PASSWD}} -DdbUrl='${{ env.TH_AURORA_POSTGRESQLURL }}' test - - name: Archive AWS RDS ${{ steps.setup.outputs.databasePlatform }}-${{ steps.setup.outputs.databaseVersion }} Test Results + - name: Archive AWS RDS ${{ needs.setup.outputs.databasePlatform }}-${{ needs.setup.outputs.databaseVersion }} Test Results uses: actions/upload-artifact@v4 with: - name: aws-rds-${{ steps.setup.outputs.databasePlatform }}-${{ steps.setup.outputs.databaseVersion }}-test-results + name: aws-rds-${{ needs.setup.outputs.databasePlatform }}-${{ needs.setup.outputs.databaseVersion }}-test-results path: build/spock-reports destroy-ephemeral-cloud-infra: From 64543c5ea461d3bf581a331acf3dcaa0795c8837 Mon Sep 17 00:00:00 2001 From: jandroav Date: Sat, 1 Jun 2024 06:58:40 +0200 Subject: [PATCH 14/37] =?UTF-8?q?=F0=9F=94=A7=20(aws-weekly.yml):=20Refact?= =?UTF-8?q?or=20GitHub=20workflow=20to=20use=20'steps'=20instead=20of=20'n?= =?UTF-8?q?eeds'=20for=20accessing=20outputs=20from=20previous=20steps.=20?= =?UTF-8?q?This=20ensures=20correct=20data=20retrieval=20for=20database=20?= =?UTF-8?q?platform=20and=20version=20configurations.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ⬆️ (aws-weekly.yml): Update references from 'needs.setup.outputs' to 'steps.setup.outputs' to align with workflow changes and improve consistency. --- .github/workflows/aws-weekly.yml | 123 +++++++++++++++++-------------- 1 file changed, 66 insertions(+), 57 deletions(-) diff --git a/.github/workflows/aws-weekly.yml b/.github/workflows/aws-weekly.yml index 05c208d5c..43e15c353 100644 --- a/.github/workflows/aws-weekly.yml +++ b/.github/workflows/aws-weekly.yml @@ -77,15 +77,24 @@ jobs: role-to-assume: ${{ secrets.AWS_DEV_GITHUB_OIDC_ROLE_ARN_BUILD_LOGIC }} aws-region: us-east-1 + - name: Configure Test + id: setup + uses: actions/github-script@v7.0.1 + with: + script: | + let splitValues = "${{ matrix.database }}".split(":") + core.setOutput("databasePlatform", splitValues[0]); + core.setOutput("databaseVersion", splitValues[1]); + - name: Get AWS secrets - if: ${{ needs.setup.outputs.databasePlatform == 'mysql' && needs.setup.outputs.databaseVersion == 'aws' }} + if: ${{ steps.setup.outputs.databasePlatform == 'mysql' && steps.setup.outputs.databaseVersion == 'aws' }} uses: aws-actions/aws-secretsmanager-get-secrets@v2 with: secret-ids: | TH_MYSQLURL_8_0, /testautomation/db_details/aws_mysql_jdbc_${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} - name: Get AWS secrets - if: ${{ needs.setup.outputs.databasePlatform == 'mysql' && needs.setup.outputs.databaseVersion == 'aurora' }} + if: ${{ steps.setup.outputs.databasePlatform == 'mysql' && steps.setup.outputs.databaseVersion == 'aurora' }} uses: aws-actions/aws-secretsmanager-get-secrets@v2 with: secret-ids: | @@ -97,7 +106,7 @@ jobs: - name: Clean AWS MySQL Database uses: liquibase-github-actions/drop-all@v4.25.1 - if: ${{ needs.setup.outputs.databasePlatform == 'mysql' && needs.setup.outputs.databaseVersion == 'aws' }} + if: ${{ steps.setup.outputs.databasePlatform == 'mysql' && steps.setup.outputs.databaseVersion == 'aws' }} with: url: "${{ env.TH_MYSQLURL_8_0 }}" username: "${{secrets.TH_DB_ADMIN}}" @@ -105,12 +114,12 @@ jobs: licenseKey: "${{secrets.LICENSE_KEY}}" - name: Init Database - if: ${{ needs.setup.outputs.databasePlatform == 'mysql' && needs.setup.outputs.databaseVersion == 'aws' }} + if: ${{ steps.setup.outputs.databasePlatform == 'mysql' && steps.setup.outputs.databaseVersion == 'aws' }} run: liquibase --classpath="src/test/resources/init-changelogs/aws" --changeLogFile="${{ matrix.database }}.sql" --username="${{ secrets.TH_DB_ADMIN }}" --password="${{ secrets.TH_DB_PASSWD }}" --url="${{ env.TH_MYSQLURL_8_0 }}" update - name: Clean Aurora MySQL Database uses: liquibase-github-actions/drop-all@v4.25.1 - if: ${{ needs.setup.outputs.databasePlatform == 'mysql' && needs.setup.outputs.databaseVersion == 'aurora' }} + if: ${{ steps.setup.outputs.databasePlatform == 'mysql' && steps.setup.outputs.databaseVersion == 'aurora' }} with: url: "${{ env.TH_AURORA_MYSQLURL }}" username: "${{secrets.TH_DB_ADMIN}}" @@ -118,7 +127,7 @@ jobs: licenseKey: "${{secrets.LICENSE_KEY}}" - name: Init Database - if: ${{ needs.setup.outputs.databasePlatform == 'mysql' && needs.setup.outputs.databaseVersion == 'aurora' }} + if: ${{ steps.setup.outputs.databasePlatform == 'mysql' && steps.setup.outputs.databaseVersion == 'aurora' }} run: liquibase --classpath="src/test/resources/init-changelogs/aws" --changeLogFile="${{ matrix.database }}.sql" --username="${{ secrets.TH_DB_ADMIN }}" --password="${{ secrets.TH_DB_PASSWD }}" --url="${{ env.TH_AURORA_MYSQLURL }}" update test: @@ -136,6 +145,15 @@ jobs: - name: Checkout uses: actions/checkout@v4 + - name: Configure Test + id: setup + uses: actions/github-script@v7.0.1 + with: + script: | + let splitValues = "${{ matrix.database }}".split(":") + core.setOutput("databasePlatform", splitValues[0]); + core.setOutput("databaseVersion", splitValues[1]); + - name: Configure AWS Credentials uses: aws-actions/configure-aws-credentials@v4 with: @@ -143,14 +161,14 @@ jobs: aws-region: us-east-1 - name: Get AWS secrets - if: ${{ needs.setup.outputs.databasePlatform == 'mysql' && needs.setup.outputs.databaseVersion == 'aws' }} + if: ${{ steps.setup.outputs.databasePlatform == 'mysql' && steps.setup.outputs.databaseVersion == 'aws' }} uses: aws-actions/aws-secretsmanager-get-secrets@v2 with: secret-ids: | TH_MYSQLURL_8_0, /testautomation/db_details/aws_mysql_jdbc_${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} - name: Get AWS secrets - if: ${{ needs.setup.outputs.databasePlatform == 'mysql' && needs.setup.outputs.databaseVersion == 'aurora' }} + if: ${{ steps.setup.outputs.databasePlatform == 'mysql' && steps.setup.outputs.databaseVersion == 'aurora' }} uses: aws-actions/aws-secretsmanager-get-secrets@v2 with: secret-ids: | @@ -158,14 +176,14 @@ jobs: - name: Get AWS secrets - if: ${{ needs.setup.outputs.databasePlatform == 'oracle' }} + if: ${{ steps.setup.outputs.databasePlatform == 'oracle' }} uses: aws-actions/aws-secretsmanager-get-secrets@v2 with: secret-ids: | TH_ORACLEURL_19, /testautomation/db_details/aws_oracle_19_jdbc_${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} - name: Get AWS secrets - if: ${{ needs.setup.outputs.databasePlatform == 'postgresql' && needs.setup.outputs.databaseVersion != 'aurora' }} + if: ${{ steps.setup.outputs.databasePlatform == 'postgresql' && steps.setup.outputs.databaseVersion != 'aurora' }} uses: aws-actions/aws-secretsmanager-get-secrets@v2 with: secret-ids: | @@ -174,37 +192,28 @@ jobs: TH_PGRESURL_14, /testautomation/db_details/aws_postgresql_14_jdbc_${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} - name: Get AWS secrets - if: ${{ needs.setup.outputs.databasePlatform == 'mariadb' }} + if: ${{ steps.setup.outputs.databasePlatform == 'mariadb' }} uses: aws-actions/aws-secretsmanager-get-secrets@v2 with: secret-ids: | TH_MARIADBURL_10_6, /testautomation/db_details/aws_mariadb_jdbc_${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} - name: Get AWS secrets - if: ${{ needs.setup.outputs.databasePlatform == 'mssql' }} + if: ${{ steps.setup.outputs.databasePlatform == 'mssql' }} uses: aws-actions/aws-secretsmanager-get-secrets@v2 with: secret-ids: | TH_MSSQLURL, /testautomation/db_details/aws_mssql_jdbc_${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} - name: Get AWS secrets - if: ${{ needs.setup.outputs.databasePlatform == 'postgresql' && needs.setup.outputs.databaseVersion == 'aurora' }} + if: ${{ steps.setup.outputs.databasePlatform == 'postgresql' && steps.setup.outputs.databaseVersion == 'aurora' }} uses: aws-actions/aws-secretsmanager-get-secrets@v2 with: secret-ids: | TH_AURORA_POSTGRESQLURL, /testautomation/db_details/aurora_postgresql_jdbc_${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} - - name: Configure Test - id: setup - uses: actions/github-script@v7.0.1 - with: - script: | - let splitValues = "${{ matrix.database }}".split(":") - core.setOutput("databasePlatform", splitValues[0]); - core.setOutput("databaseVersion", splitValues[1]); - - uses: liquibase-github-actions/drop-all@v4.25.1 - if: ${{ needs.setup.outputs.databasePlatform == 'oracle' }} + if: ${{ steps.setup.outputs.databasePlatform == 'oracle' }} with: url: "${{ env.TH_ORACLEURL_19 }}" username: "${{secrets.TH_DB_ADMIN}}" @@ -212,7 +221,7 @@ jobs: licenseKey: "${{secrets.LICENSE_KEY}}" - uses: liquibase/liquibase-github-action@v7 - if: ${{ needs.setup.outputs.databasePlatform == 'oracle' }} + if: ${{ steps.setup.outputs.databasePlatform == 'oracle' }} with: operation: "update" classpath: "src/test/resources/init-changelogs/aws" @@ -222,25 +231,25 @@ jobs: url: "${{ env.TH_ORACLEURL_19 }}" - uses: liquibase-github-actions/drop-all@v4.25.1 - if: ${{ needs.setup.outputs.databasePlatform == 'postgresql' && needs.setup.outputs.databaseVersion != 'aurora' }} + if: ${{ steps.setup.outputs.databasePlatform == 'postgresql' && steps.setup.outputs.databaseVersion != 'aurora' }} with: - url: "${{ env[format('TH_PGRESURL_{0}', needs.setup.outputs.databaseVersion)] }}" + url: "${{ env[format('TH_PGRESURL_{0}', steps.setup.outputs.databaseVersion)] }}" username: "${{secrets.TH_DB_ADMIN}}" password: "${{secrets.TH_DB_PASSWD}}" licenseKey: "${{secrets.LICENSE_KEY}}" - uses: liquibase/liquibase-github-action@v7 - if: ${{ needs.setup.outputs.databasePlatform == 'postgresql' && needs.setup.outputs.databaseVersion != 'aurora' }} + if: ${{ steps.setup.outputs.databasePlatform == 'postgresql' && steps.setup.outputs.databaseVersion != 'aurora' }} with: operation: "update" classpath: "src/test/resources/init-changelogs/aws" changeLogFile: "postgresql.sql" username: "${{secrets.TH_DB_ADMIN}}" password: "${{secrets.TH_DB_PASSWD}}" - url: "${{ env[format('TH_PGRESURL_{0}', needs.setup.outputs.databaseVersion)] }}" + url: "${{ env[format('TH_PGRESURL_{0}', steps.setup.outputs.databaseVersion)] }}" - uses: liquibase-github-actions/drop-all@v4.25.1 - if: ${{ needs.setup.outputs.databasePlatform == 'mariadb' }} + if: ${{ steps.setup.outputs.databasePlatform == 'mariadb' }} with: url: "${{ env.TH_MARIADBURL_10_6 }}" username: "${{secrets.TH_DB_ADMIN}}" @@ -248,7 +257,7 @@ jobs: licenseKey: "${{secrets.LICENSE_KEY}}" - uses: liquibase/liquibase-github-action@v7 - if: ${{ needs.setup.outputs.databasePlatform == 'mariadb' }} + if: ${{ steps.setup.outputs.databasePlatform == 'mariadb' }} with: operation: "update" classpath: "src/test/resources/init-changelogs/aws" @@ -258,7 +267,7 @@ jobs: url: "${{ env.TH_MARIADBURL_10_6 }}" - uses: liquibase-github-actions/drop-all@v4.25.1 - if: ${{ needs.setup.outputs.databasePlatform == 'mssql' }} + if: ${{ steps.setup.outputs.databasePlatform == 'mssql' }} with: url: "${{ env.TH_MSSQLURL }}" username: "${{secrets.TH_DB_ADMIN}}" @@ -266,7 +275,7 @@ jobs: licenseKey: "${{secrets.LICENSE_KEY}}" - uses: liquibase/liquibase-github-action@v7 - if: ${{ needs.setup.outputs.databasePlatform == 'mssql' }} + if: ${{ steps.setup.outputs.databasePlatform == 'mssql' }} with: operation: "update" classpath: "src/test/resources/init-changelogs/aws" @@ -276,7 +285,7 @@ jobs: url: "${{ env.TH_MSSQLURL }}" - uses: liquibase-github-actions/drop-all@v4.25.1 - if: ${{ needs.setup.outputs.databasePlatform == 'postgresql' && needs.setup.outputs.databaseVersion == 'aurora' }} + if: ${{ steps.setup.outputs.databasePlatform == 'postgresql' && steps.setup.outputs.databaseVersion == 'aurora' }} with: url: "${{ env.TH_AURORA_POSTGRESQLURL }}" username: "${{secrets.TH_DB_ADMIN}}" @@ -284,7 +293,7 @@ jobs: licenseKey: "${{secrets.LICENSE_KEY}}" - uses: liquibase/liquibase-github-action@v7 - if: ${{ needs.setup.outputs.databasePlatform == 'postgresql' && needs.setup.outputs.databaseVersion == 'aurora' }} + if: ${{ steps.setup.outputs.databasePlatform == 'postgresql' && steps.setup.outputs.databaseVersion == 'aurora' }} with: operation: "update" classpath: "src/test/resources/init-changelogs/aws" @@ -301,52 +310,52 @@ jobs: restore-keys: | ${{ runner.os }}-maven- - - name: AWS RDS ${{ needs.setup.outputs.databasePlatform }}-${{ needs.setup.outputs.databaseVersion }} Test Run - if: ${{ needs.setup.outputs.databasePlatform == 'postgresql' && needs.setup.outputs.databaseVersion != 'aurora' }} + - name: AWS RDS ${{ steps.setup.outputs.databasePlatform }}-${{ steps.setup.outputs.databaseVersion }} Test Run + if: ${{ steps.setup.outputs.databasePlatform == 'postgresql' && steps.setup.outputs.databaseVersion != 'aurora' }} env: LIQUIBASE_PRO_LICENSE_KEY: ${{ secrets.LICENSE_KEY }} - run: mvn -Dtest=${{ needs.setup.outputs.testClasses }} -DconfigFile=/harness-config-cloud.yml -DdbName=${{ needs.setup.outputs.databasePlatform }} -DdbVersion=${{ needs.setup.outputs.databaseVersion }} -Dprefix=aws -DdbUsername=${{secrets.TH_DB_ADMIN}} -DdbPassword=${{secrets.TH_DB_PASSWD}} -DdbUrl='${{ env[format('TH_PGRESURL_{0}', needs.setup.outputs.databaseVersion)] }}' test + run: mvn -Dtest=${{ needs.setup.outputs.testClasses }} -DconfigFile=/harness-config-cloud.yml -DdbName=${{ steps.setup.outputs.databasePlatform }} -DdbVersion=${{ steps.setup.outputs.databaseVersion }} -Dprefix=aws -DdbUsername=${{secrets.TH_DB_ADMIN}} -DdbPassword=${{secrets.TH_DB_PASSWD}} -DdbUrl='${{ env[format('TH_PGRESURL_{0}', steps.setup.outputs.databaseVersion)] }}' test - - name: AWS RDS ${{ needs.setup.outputs.databasePlatform }}-${{ needs.setup.outputs.databaseVersion }} Test Run - if: ${{ needs.setup.outputs.databasePlatform == 'oracle' }} + - name: AWS RDS ${{ steps.setup.outputs.databasePlatform }}-${{ steps.setup.outputs.databaseVersion }} Test Run + if: ${{ steps.setup.outputs.databasePlatform == 'oracle' }} env: LIQUIBASE_PRO_LICENSE_KEY: ${{ secrets.LICENSE_KEY }} - run: mvn -Dtest=${{ needs.setup.outputs.testClasses }} -DconfigFile=/harness-config-cloud.yml -DdbName=${{ needs.setup.outputs.databasePlatform }} -DdbVersion=${{ needs.setup.outputs.databaseVersion }} -DdbUsername=${{secrets.TH_DB_ADMIN}} -DdbPassword=${{secrets.TH_DB_PASSWD}} -DdbUrl='${{ env.TH_ORACLEURL_19 }}' test + run: mvn -Dtest=${{ needs.setup.outputs.testClasses }} -DconfigFile=/harness-config-cloud.yml -DdbName=${{ steps.setup.outputs.databasePlatform }} -DdbVersion=${{ steps.setup.outputs.databaseVersion }} -DdbUsername=${{secrets.TH_DB_ADMIN}} -DdbPassword=${{secrets.TH_DB_PASSWD}} -DdbUrl='${{ env.TH_ORACLEURL_19 }}' test - - name: AWS RDS ${{ needs.setup.outputs.databasePlatform }}-${{ needs.setup.outputs.databaseVersion }} Test Run - if: ${{ needs.setup.outputs.databasePlatform == 'mariadb' }} + - name: AWS RDS ${{ steps.setup.outputs.databasePlatform }}-${{ steps.setup.outputs.databaseVersion }} Test Run + if: ${{ steps.setup.outputs.databasePlatform == 'mariadb' }} env: LIQUIBASE_PRO_LICENSE_KEY: ${{ secrets.LICENSE_KEY }} - run: mvn -Dtest=${{ needs.setup.outputs.testClasses }} -DconfigFile=/harness-config-cloud.yml -DdbName=${{ needs.setup.outputs.databasePlatform }} -DdbVersion=${{ needs.setup.outputs.databaseVersion }} -DdbUsername=${{secrets.TH_DB_ADMIN}} -DdbPassword=${{secrets.TH_DB_PASSWD}} -DdbUrl='${{ env.TH_MARIADBURL_10_6 }}' test + run: mvn -Dtest=${{ needs.setup.outputs.testClasses }} -DconfigFile=/harness-config-cloud.yml -DdbName=${{ steps.setup.outputs.databasePlatform }} -DdbVersion=${{ steps.setup.outputs.databaseVersion }} -DdbUsername=${{secrets.TH_DB_ADMIN}} -DdbPassword=${{secrets.TH_DB_PASSWD}} -DdbUrl='${{ env.TH_MARIADBURL_10_6 }}' test - - name: AWS RDS ${{ needs.setup.outputs.databasePlatform }}-${{ needs.setup.outputs.databaseVersion }} Test Run - if: ${{ needs.setup.outputs.databasePlatform == 'mysql' && needs.setup.outputs.databaseVersion == 'aws' }} + - name: AWS RDS ${{ steps.setup.outputs.databasePlatform }}-${{ steps.setup.outputs.databaseVersion }} Test Run + if: ${{ steps.setup.outputs.databasePlatform == 'mysql' && steps.setup.outputs.databaseVersion == 'aws' }} env: LIQUIBASE_PRO_LICENSE_KEY: ${{ secrets.LICENSE_KEY }} - run: mvn -Dtest=${{ needs.setup.outputs.testClasses }} -DconfigFile=/harness-config-cloud.yml -DdbName=${{ needs.setup.outputs.databasePlatform }} -DdbVersion=${{ needs.setup.outputs.databaseVersion }} -DdbUsername=${{secrets.TH_DB_ADMIN}} -DdbPassword=${{secrets.TH_DB_PASSWD}} -DdbUrl='${{ env.TH_MYSQLURL_8_0 }}' test + run: mvn -Dtest=${{ needs.setup.outputs.testClasses }} -DconfigFile=/harness-config-cloud.yml -DdbName=${{ steps.setup.outputs.databasePlatform }} -DdbVersion=${{ steps.setup.outputs.databaseVersion }} -DdbUsername=${{secrets.TH_DB_ADMIN}} -DdbPassword=${{secrets.TH_DB_PASSWD}} -DdbUrl='${{ env.TH_MYSQLURL_8_0 }}' test - - name: AWS RDS ${{ needs.setup.outputs.databasePlatform }}-${{ needs.setup.outputs.databaseVersion }} Test Run - if: ${{ needs.setup.outputs.databasePlatform == 'mssql' }} + - name: AWS RDS ${{ steps.setup.outputs.databasePlatform }}-${{ steps.setup.outputs.databaseVersion }} Test Run + if: ${{ steps.setup.outputs.databasePlatform == 'mssql' }} env: LIQUIBASE_PRO_LICENSE_KEY: ${{ secrets.LICENSE_KEY }} - run: mvn -Dtest=${{ needs.setup.outputs.testClasses }} -DconfigFile=/harness-config-cloud.yml -DdbName=${{ needs.setup.outputs.databasePlatform }} -DdbVersion=${{ needs.setup.outputs.databaseVersion }} -DdbUsername=${{secrets.TH_DB_ADMIN}} -DdbPassword=${{secrets.TH_DB_PASSWD}} -DdbUrl='${{ env.TH_MSSQLURL }}' test + run: mvn -Dtest=${{ needs.setup.outputs.testClasses }} -DconfigFile=/harness-config-cloud.yml -DdbName=${{ steps.setup.outputs.databasePlatform }} -DdbVersion=${{ steps.setup.outputs.databaseVersion }} -DdbUsername=${{secrets.TH_DB_ADMIN}} -DdbPassword=${{secrets.TH_DB_PASSWD}} -DdbUrl='${{ env.TH_MSSQLURL }}' test - - name: AWS Aurora ${{ needs.setup.outputs.databasePlatform }} Test Run - if: ${{ needs.setup.outputs.databasePlatform == 'mysql' && needs.setup.outputs.databaseVersion == 'aurora' }} + - name: AWS Aurora ${{ steps.setup.outputs.databasePlatform }} Test Run + if: ${{ steps.setup.outputs.databasePlatform == 'mysql' && steps.setup.outputs.databaseVersion == 'aurora' }} env: LIQUIBASE_PRO_LICENSE_KEY: ${{ secrets.LICENSE_KEY }} - run: mvn -Dtest=${{ needs.setup.outputs.testClasses }} -DconfigFile=/harness-config-cloud.yml -DdbName=${{ needs.setup.outputs.databasePlatform }} -DdbVersion=${{ needs.setup.outputs.databaseVersion }} -DdbUsername=${{secrets.TH_DB_ADMIN}} -DdbPassword=${{secrets.TH_DB_PASSWD}} -DdbUrl='${{ env.TH_AURORA_MYSQLURL }}' test + run: mvn -Dtest=${{ needs.setup.outputs.testClasses }} -DconfigFile=/harness-config-cloud.yml -DdbName=${{ steps.setup.outputs.databasePlatform }} -DdbVersion=${{ steps.setup.outputs.databaseVersion }} -DdbUsername=${{secrets.TH_DB_ADMIN}} -DdbPassword=${{secrets.TH_DB_PASSWD}} -DdbUrl='${{ env.TH_AURORA_MYSQLURL }}' test - - name: AWS Aurora ${{ needs.setup.outputs.databasePlatform }} Test Run - if: ${{ needs.setup.outputs.databasePlatform == 'postgresql' && needs.setup.outputs.databaseVersion == 'aurora' }} + - name: AWS Aurora ${{ steps.setup.outputs.databasePlatform }} Test Run + if: ${{ steps.setup.outputs.databasePlatform == 'postgresql' && steps.setup.outputs.databaseVersion == 'aurora' }} env: LIQUIBASE_PRO_LICENSE_KEY: ${{ secrets.LICENSE_KEY }} - run: mvn -Dtest=${{ needs.setup.outputs.testClasses }} -DconfigFile=/harness-config-cloud.yml -DdbName=${{ needs.setup.outputs.databasePlatform }} -DdbVersion=13 -Dprefix=aurora -DdbUsername=${{secrets.TH_DB_ADMIN}} -DdbPassword=${{secrets.TH_DB_PASSWD}} -DdbUrl='${{ env.TH_AURORA_POSTGRESQLURL }}' test + run: mvn -Dtest=${{ needs.setup.outputs.testClasses }} -DconfigFile=/harness-config-cloud.yml -DdbName=${{ steps.setup.outputs.databasePlatform }} -DdbVersion=13 -Dprefix=aurora -DdbUsername=${{secrets.TH_DB_ADMIN}} -DdbPassword=${{secrets.TH_DB_PASSWD}} -DdbUrl='${{ env.TH_AURORA_POSTGRESQLURL }}' test - - name: Archive AWS RDS ${{ needs.setup.outputs.databasePlatform }}-${{ needs.setup.outputs.databaseVersion }} Test Results + - name: Archive AWS RDS ${{ steps.setup.outputs.databasePlatform }}-${{ steps.setup.outputs.databaseVersion }} Test Results uses: actions/upload-artifact@v4 with: - name: aws-rds-${{ needs.setup.outputs.databasePlatform }}-${{ needs.setup.outputs.databaseVersion }}-test-results + name: aws-rds-${{ steps.setup.outputs.databasePlatform }}-${{ steps.setup.outputs.databaseVersion }}-test-results path: build/spock-reports destroy-ephemeral-cloud-infra: From d3eacc0a9218ae8f6ac7511908a0cc295e8ac03c Mon Sep 17 00:00:00 2001 From: jandroav Date: Sat, 1 Jun 2024 09:26:54 +0200 Subject: [PATCH 15/37] =?UTF-8?q?=F0=9F=94=A7=20(aws-weekly.yml):=20update?= =?UTF-8?q?=20job=20dependencies=20to=20include=20deploy-ephemeral-cloud-i?= =?UTF-8?q?nfra=20before=20test=20job=20for=20proper=20execution=20order?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/aws-weekly.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/aws-weekly.yml b/.github/workflows/aws-weekly.yml index 43e15c353..b558a5c66 100644 --- a/.github/workflows/aws-weekly.yml +++ b/.github/workflows/aws-weekly.yml @@ -131,7 +131,7 @@ jobs: run: liquibase --classpath="src/test/resources/init-changelogs/aws" --changeLogFile="${{ matrix.database }}.sql" --username="${{ secrets.TH_DB_ADMIN }}" --password="${{ secrets.TH_DB_PASSWD }}" --url="${{ env.TH_AURORA_MYSQLURL }}" update test: - needs: [init-mysql, setup] + needs: [deploy-ephemeral-cloud-infra, init-mysql, setup] permissions: contents: read id-token: write From 96efe1c7f96e957d0d9768b6ea68918ef1377d80 Mon Sep 17 00:00:00 2001 From: jandroav Date: Sat, 1 Jun 2024 12:00:03 +0200 Subject: [PATCH 16/37] =?UTF-8?q?=F0=9F=94=A7=20(aws-weekly.yml):=20Remove?= =?UTF-8?q?=20unnecessary=20database=20cleanup=20steps=20to=20streamline?= =?UTF-8?q?=20workflow=20and=20improve=20efficiency=20=F0=9F=94=A7=20(aws-?= =?UTF-8?q?weekly.yml):=20Simplify=20database=20initialization=20steps=20f?= =?UTF-8?q?or=20different=20database=20platforms=20to=20enhance=20maintain?= =?UTF-8?q?ability=20and=20readability?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/aws-weekly.yml | 58 -------------------------------- 1 file changed, 58 deletions(-) diff --git a/.github/workflows/aws-weekly.yml b/.github/workflows/aws-weekly.yml index b558a5c66..e6c720a5c 100644 --- a/.github/workflows/aws-weekly.yml +++ b/.github/workflows/aws-weekly.yml @@ -104,28 +104,10 @@ jobs: - name: Install Dependencies run: lpm update && lpm add mysql - - name: Clean AWS MySQL Database - uses: liquibase-github-actions/drop-all@v4.25.1 - if: ${{ steps.setup.outputs.databasePlatform == 'mysql' && steps.setup.outputs.databaseVersion == 'aws' }} - with: - url: "${{ env.TH_MYSQLURL_8_0 }}" - username: "${{secrets.TH_DB_ADMIN}}" - password: "${{secrets.TH_DB_PASSWD}}" - licenseKey: "${{secrets.LICENSE_KEY}}" - - name: Init Database if: ${{ steps.setup.outputs.databasePlatform == 'mysql' && steps.setup.outputs.databaseVersion == 'aws' }} run: liquibase --classpath="src/test/resources/init-changelogs/aws" --changeLogFile="${{ matrix.database }}.sql" --username="${{ secrets.TH_DB_ADMIN }}" --password="${{ secrets.TH_DB_PASSWD }}" --url="${{ env.TH_MYSQLURL_8_0 }}" update - - name: Clean Aurora MySQL Database - uses: liquibase-github-actions/drop-all@v4.25.1 - if: ${{ steps.setup.outputs.databasePlatform == 'mysql' && steps.setup.outputs.databaseVersion == 'aurora' }} - with: - url: "${{ env.TH_AURORA_MYSQLURL }}" - username: "${{secrets.TH_DB_ADMIN}}" - password: "${{secrets.TH_DB_PASSWD}}" - licenseKey: "${{secrets.LICENSE_KEY}}" - - name: Init Database if: ${{ steps.setup.outputs.databasePlatform == 'mysql' && steps.setup.outputs.databaseVersion == 'aurora' }} run: liquibase --classpath="src/test/resources/init-changelogs/aws" --changeLogFile="${{ matrix.database }}.sql" --username="${{ secrets.TH_DB_ADMIN }}" --password="${{ secrets.TH_DB_PASSWD }}" --url="${{ env.TH_AURORA_MYSQLURL }}" update @@ -212,14 +194,6 @@ jobs: secret-ids: | TH_AURORA_POSTGRESQLURL, /testautomation/db_details/aurora_postgresql_jdbc_${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} - - uses: liquibase-github-actions/drop-all@v4.25.1 - if: ${{ steps.setup.outputs.databasePlatform == 'oracle' }} - with: - url: "${{ env.TH_ORACLEURL_19 }}" - username: "${{secrets.TH_DB_ADMIN}}" - password: "${{secrets.TH_DB_PASSWD}}" - licenseKey: "${{secrets.LICENSE_KEY}}" - - uses: liquibase/liquibase-github-action@v7 if: ${{ steps.setup.outputs.databasePlatform == 'oracle' }} with: @@ -230,14 +204,6 @@ jobs: password: "${{secrets.TH_DB_PASSWD}}" url: "${{ env.TH_ORACLEURL_19 }}" - - uses: liquibase-github-actions/drop-all@v4.25.1 - if: ${{ steps.setup.outputs.databasePlatform == 'postgresql' && steps.setup.outputs.databaseVersion != 'aurora' }} - with: - url: "${{ env[format('TH_PGRESURL_{0}', steps.setup.outputs.databaseVersion)] }}" - username: "${{secrets.TH_DB_ADMIN}}" - password: "${{secrets.TH_DB_PASSWD}}" - licenseKey: "${{secrets.LICENSE_KEY}}" - - uses: liquibase/liquibase-github-action@v7 if: ${{ steps.setup.outputs.databasePlatform == 'postgresql' && steps.setup.outputs.databaseVersion != 'aurora' }} with: @@ -248,14 +214,6 @@ jobs: password: "${{secrets.TH_DB_PASSWD}}" url: "${{ env[format('TH_PGRESURL_{0}', steps.setup.outputs.databaseVersion)] }}" - - uses: liquibase-github-actions/drop-all@v4.25.1 - if: ${{ steps.setup.outputs.databasePlatform == 'mariadb' }} - with: - url: "${{ env.TH_MARIADBURL_10_6 }}" - username: "${{secrets.TH_DB_ADMIN}}" - password: "${{secrets.TH_DB_PASSWD}}" - licenseKey: "${{secrets.LICENSE_KEY}}" - - uses: liquibase/liquibase-github-action@v7 if: ${{ steps.setup.outputs.databasePlatform == 'mariadb' }} with: @@ -266,14 +224,6 @@ jobs: password: "${{secrets.TH_DB_PASSWD}}" url: "${{ env.TH_MARIADBURL_10_6 }}" - - uses: liquibase-github-actions/drop-all@v4.25.1 - if: ${{ steps.setup.outputs.databasePlatform == 'mssql' }} - with: - url: "${{ env.TH_MSSQLURL }}" - username: "${{secrets.TH_DB_ADMIN}}" - password: "${{secrets.TH_DB_PASSWD}}" - licenseKey: "${{secrets.LICENSE_KEY}}" - - uses: liquibase/liquibase-github-action@v7 if: ${{ steps.setup.outputs.databasePlatform == 'mssql' }} with: @@ -284,14 +234,6 @@ jobs: password: "${{secrets.TH_DB_PASSWD}}" url: "${{ env.TH_MSSQLURL }}" - - uses: liquibase-github-actions/drop-all@v4.25.1 - if: ${{ steps.setup.outputs.databasePlatform == 'postgresql' && steps.setup.outputs.databaseVersion == 'aurora' }} - with: - url: "${{ env.TH_AURORA_POSTGRESQLURL }}" - username: "${{secrets.TH_DB_ADMIN}}" - password: "${{secrets.TH_DB_PASSWD}}" - licenseKey: "${{secrets.LICENSE_KEY}}" - - uses: liquibase/liquibase-github-action@v7 if: ${{ steps.setup.outputs.databasePlatform == 'postgresql' && steps.setup.outputs.databaseVersion == 'aurora' }} with: From 429c2ad29834f9611e216ff52e537d23db1166b1 Mon Sep 17 00:00:00 2001 From: jandroav Date: Sat, 1 Jun 2024 13:02:20 +0200 Subject: [PATCH 17/37] =?UTF-8?q?=F0=9F=94=A7=20(aws-weekly.yml):=20refact?= =?UTF-8?q?or=20workflow=20to=20use=20a=20matrix=20for=20database=20versio?= =?UTF-8?q?ns=20instead=20of=20individual=20conditions=20for=20'aws'=20and?= =?UTF-8?q?=20'aurora'=20versions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/aws-weekly.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/aws-weekly.yml b/.github/workflows/aws-weekly.yml index e6c720a5c..173c3f50c 100644 --- a/.github/workflows/aws-weekly.yml +++ b/.github/workflows/aws-weekly.yml @@ -87,14 +87,14 @@ jobs: core.setOutput("databaseVersion", splitValues[1]); - name: Get AWS secrets - if: ${{ steps.setup.outputs.databasePlatform == 'mysql' && steps.setup.outputs.databaseVersion == 'aws' }} + if: ${{ matrix.version == 'aws' }} uses: aws-actions/aws-secretsmanager-get-secrets@v2 with: secret-ids: | TH_MYSQLURL_8_0, /testautomation/db_details/aws_mysql_jdbc_${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} - name: Get AWS secrets - if: ${{ steps.setup.outputs.databasePlatform == 'mysql' && steps.setup.outputs.databaseVersion == 'aurora' }} + if: ${{ matrix.version == 'aurora' }} uses: aws-actions/aws-secretsmanager-get-secrets@v2 with: secret-ids: | @@ -105,11 +105,11 @@ jobs: run: lpm update && lpm add mysql - name: Init Database - if: ${{ steps.setup.outputs.databasePlatform == 'mysql' && steps.setup.outputs.databaseVersion == 'aws' }} + if: ${{ matrix.version == 'aws' }} run: liquibase --classpath="src/test/resources/init-changelogs/aws" --changeLogFile="${{ matrix.database }}.sql" --username="${{ secrets.TH_DB_ADMIN }}" --password="${{ secrets.TH_DB_PASSWD }}" --url="${{ env.TH_MYSQLURL_8_0 }}" update - name: Init Database - if: ${{ steps.setup.outputs.databasePlatform == 'mysql' && steps.setup.outputs.databaseVersion == 'aurora' }} + if: ${{ matrix.version == 'aurora' }} run: liquibase --classpath="src/test/resources/init-changelogs/aws" --changeLogFile="${{ matrix.database }}.sql" --username="${{ secrets.TH_DB_ADMIN }}" --password="${{ secrets.TH_DB_PASSWD }}" --url="${{ env.TH_AURORA_MYSQLURL }}" update test: From cd836da6b48e4daebe9135b653ad4abc979ac48c Mon Sep 17 00:00:00 2001 From: jandroav Date: Sat, 1 Jun 2024 13:37:14 +0200 Subject: [PATCH 18/37] =?UTF-8?q?=F0=9F=94=A7=20(aws-weekly.yml):=20update?= =?UTF-8?q?=20liquibase=20changeLogFile=20to=20include=20"=5Fcloud"=20suff?= =?UTF-8?q?ix=20for=20cloud=20databases=20to=20differentiate=20from=20regu?= =?UTF-8?q?lar=20databases=20=F0=9F=94=A7=20(aws-weekly.yml):=20update=20l?= =?UTF-8?q?iquibase=20url=20to=20use=20TH=5FAURORA=5FMYSQLURL=20for=20auro?= =?UTF-8?q?ra=20database=20version=20=F0=9F=94=A7=20(aws-weekly.yml):=20ad?= =?UTF-8?q?d=20new=20mysql=5Fcloud.sql=20file=20with=20initial=20SQL=20scr?= =?UTF-8?q?ipts=20for=20cloud=20database=20tables=20"authors"=20and=20"pos?= =?UTF-8?q?ts"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/aws-weekly.yml | 4 +- .../init-changelogs/aws/mysql_cloud.sql | 37 +++++++++++++++++++ 2 files changed, 39 insertions(+), 2 deletions(-) create mode 100644 src/test/resources/init-changelogs/aws/mysql_cloud.sql diff --git a/.github/workflows/aws-weekly.yml b/.github/workflows/aws-weekly.yml index 173c3f50c..4f2489d16 100644 --- a/.github/workflows/aws-weekly.yml +++ b/.github/workflows/aws-weekly.yml @@ -106,11 +106,11 @@ jobs: - name: Init Database if: ${{ matrix.version == 'aws' }} - run: liquibase --classpath="src/test/resources/init-changelogs/aws" --changeLogFile="${{ matrix.database }}.sql" --username="${{ secrets.TH_DB_ADMIN }}" --password="${{ secrets.TH_DB_PASSWD }}" --url="${{ env.TH_MYSQLURL_8_0 }}" update + run: liquibase --classpath="src/test/resources/init-changelogs/aws" --changeLogFile="${{ matrix.database }}_cloud.sql" --username="${{ secrets.TH_DB_ADMIN }}" --password="${{ secrets.TH_DB_PASSWD }}" --url="${{ env.TH_MYSQLURL_8_0 }}" update - name: Init Database if: ${{ matrix.version == 'aurora' }} - run: liquibase --classpath="src/test/resources/init-changelogs/aws" --changeLogFile="${{ matrix.database }}.sql" --username="${{ secrets.TH_DB_ADMIN }}" --password="${{ secrets.TH_DB_PASSWD }}" --url="${{ env.TH_AURORA_MYSQLURL }}" update + run: liquibase --classpath="src/test/resources/init-changelogs/aws" --changeLogFile="${{ matrix.database }}_cloud.sql" --username="${{ secrets.TH_DB_ADMIN }}" --password="${{ secrets.TH_DB_PASSWD }}" --url="${{ env.TH_AURORA_MYSQLURL }}" update test: needs: [deploy-ephemeral-cloud-infra, init-mysql, setup] diff --git a/src/test/resources/init-changelogs/aws/mysql_cloud.sql b/src/test/resources/init-changelogs/aws/mysql_cloud.sql new file mode 100644 index 000000000..11c45bc29 --- /dev/null +++ b/src/test/resources/init-changelogs/aws/mysql_cloud.sql @@ -0,0 +1,37 @@ +--liquibase formatted sql +--changeset liquibase:1 runAlways:true +DROP TABLE IF EXISTS `authors`; +CREATE TABLE `authors` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `first_name` varchar(50) COLLATE utf8_unicode_ci NOT NULL, + `last_name` varchar(50) COLLATE utf8_unicode_ci NOT NULL, + `email` varchar(100) COLLATE utf8_unicode_ci NOT NULL, + `birthdate` date NOT NULL, + `added` timestamp NOT NULL DEFAULT current_timestamp(), + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +--changeset liquibase:2 runAlways:true +INSERT INTO `authors` VALUES ('1','Eileen','Lubowitz','ppaucek@example.org','1991-03-04','2004-05-30 02:08:25'), + ('2','Tamia','Mayert','shansen@example.org','2016-03-27','2014-03-21 02:52:00'), + ('3','Cyril','Funk','reynolds.godfrey@example.com','1988-04-21','2011-06-24 18:17:48'), + ('4','Nicolas','Buckridge','xhoeger@example.net','2017-02-03','2019-04-22 02:04:41'), + ('5','Jayden','Walter','lillian66@example.com','2010-02-27','1990-02-04 02:32:00'); + +--changeset liquibase:3 runAlways:true +DROP TABLE IF EXISTS `posts`; +CREATE TABLE `posts` ( + `id` int(11) NOT NULL, + `author_id` int(11) NOT NULL, + `title` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `description` varchar(500) COLLATE utf8_unicode_ci NOT NULL, + `content` text COLLATE utf8_unicode_ci NOT NULL, + `inserted_date` date +) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +--changeset liquibase:4 runAlways:true +INSERT INTO `posts` VALUES ('1','1','temporibus','voluptatum','Fugit non et doloribus repudiandae.','2015-11-18'), + ('2','2','ea','aut','Tempora molestias maiores provident molestiae sint possimus quasi.','1975-06-08'), + ('3','3','illum','rerum','Delectus recusandae sit officiis dolor.','1975-02-25'), + ('4','4','itaque','deleniti','Magni nam optio id recusandae.','2010-07-28'), + ('5','5','ad','similique','Rerum tempore quis ut nesciunt qui excepturi est.','2006-10-09'); From 04ff8b2ddca2bd9aa788b3730437981f7859f489 Mon Sep 17 00:00:00 2001 From: jandroav Date: Sat, 1 Jun 2024 14:45:49 +0200 Subject: [PATCH 19/37] =?UTF-8?q?=F0=9F=94=A7=20(aws-weekly.yml):=20Update?= =?UTF-8?q?=20conditional=20statements=20to=20fetch=20AWS=20secrets=20only?= =?UTF-8?q?=20for=20MySQL=20databases=20when=20the=20version=20is=20'aws'?= =?UTF-8?q?=20or=20'aurora'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/aws-weekly.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/aws-weekly.yml b/.github/workflows/aws-weekly.yml index 4f2489d16..c94dbc758 100644 --- a/.github/workflows/aws-weekly.yml +++ b/.github/workflows/aws-weekly.yml @@ -87,14 +87,14 @@ jobs: core.setOutput("databaseVersion", splitValues[1]); - name: Get AWS secrets - if: ${{ matrix.version == 'aws' }} + if: ${{ matrix.version == 'aws' && matrix.database == 'mysql'}} uses: aws-actions/aws-secretsmanager-get-secrets@v2 with: secret-ids: | TH_MYSQLURL_8_0, /testautomation/db_details/aws_mysql_jdbc_${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} - name: Get AWS secrets - if: ${{ matrix.version == 'aurora' }} + if: ${{ matrix.version == 'aurora' && matrix.database == 'mysql'}} uses: aws-actions/aws-secretsmanager-get-secrets@v2 with: secret-ids: | From b79f090d1fed7439337f8c5418d22cf65ba21d34 Mon Sep 17 00:00:00 2001 From: jandroav Date: Sat, 1 Jun 2024 18:59:49 +0200 Subject: [PATCH 20/37] =?UTF-8?q?=F0=9F=93=9D=20(mssql.sql):=20add=20USE?= =?UTF-8?q?=20lbcat;=20statement=20to=20specify=20the=20database=20to=20us?= =?UTF-8?q?e=20before=20executing=20SQL=20commands=20for=20better=20clarit?= =?UTF-8?q?y=20and=20consistency?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/test/resources/init-changelogs/aws/mssql.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/src/test/resources/init-changelogs/aws/mssql.sql b/src/test/resources/init-changelogs/aws/mssql.sql index a084154db..26f34ba2c 100644 --- a/src/test/resources/init-changelogs/aws/mssql.sql +++ b/src/test/resources/init-changelogs/aws/mssql.sql @@ -1,5 +1,6 @@ --liquibase formatted sql --changeset liquibase:1 runAlways:true +USE lbcat; DROP TABLE IF EXISTS [dbo].[authors] CREATE TABLE [dbo].[authors]( [id] [int] NOT NULL, From 82a161e051fd65376635839227d337252714f319 Mon Sep 17 00:00:00 2001 From: jandroav Date: Sat, 1 Jun 2024 19:04:39 +0200 Subject: [PATCH 21/37] =?UTF-8?q?=F0=9F=93=9D=20(mssql.sql):=20remove=20un?= =?UTF-8?q?necessary=20USE=20lbcat;=20statement=20and=20fix=20DROP=20TABLE?= =?UTF-8?q?=20IF=20EXISTS=20syntax=20to=20improve=20script=20readability?= =?UTF-8?q?=20and=20maintainability?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/test/resources/init-changelogs/aws/mssql.sql | 1 - 1 file changed, 1 deletion(-) diff --git a/src/test/resources/init-changelogs/aws/mssql.sql b/src/test/resources/init-changelogs/aws/mssql.sql index 26f34ba2c..a084154db 100644 --- a/src/test/resources/init-changelogs/aws/mssql.sql +++ b/src/test/resources/init-changelogs/aws/mssql.sql @@ -1,6 +1,5 @@ --liquibase formatted sql --changeset liquibase:1 runAlways:true -USE lbcat; DROP TABLE IF EXISTS [dbo].[authors] CREATE TABLE [dbo].[authors]( [id] [int] NOT NULL, From 071f2a3fa178a5393180a1b998983f6e7dd1db24 Mon Sep 17 00:00:00 2001 From: jandroav Date: Sat, 1 Jun 2024 19:57:38 +0200 Subject: [PATCH 22/37] =?UTF-8?q?=F0=9F=94=A7=20(aws-weekly.yml):=20Remove?= =?UTF-8?q?=20redundant=20database=20initialization=20steps=20for=20'aws'?= =?UTF-8?q?=20and=20'aurora'=20versions=20to=20streamline=20workflow=20and?= =?UTF-8?q?=20avoid=20unnecessary=20configurations.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/aws-weekly.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.github/workflows/aws-weekly.yml b/.github/workflows/aws-weekly.yml index c94dbc758..e7e05e1b3 100644 --- a/.github/workflows/aws-weekly.yml +++ b/.github/workflows/aws-weekly.yml @@ -104,13 +104,7 @@ jobs: - name: Install Dependencies run: lpm update && lpm add mysql - - name: Init Database - if: ${{ matrix.version == 'aws' }} - run: liquibase --classpath="src/test/resources/init-changelogs/aws" --changeLogFile="${{ matrix.database }}_cloud.sql" --username="${{ secrets.TH_DB_ADMIN }}" --password="${{ secrets.TH_DB_PASSWD }}" --url="${{ env.TH_MYSQLURL_8_0 }}" update - - name: Init Database - if: ${{ matrix.version == 'aurora' }} - run: liquibase --classpath="src/test/resources/init-changelogs/aws" --changeLogFile="${{ matrix.database }}_cloud.sql" --username="${{ secrets.TH_DB_ADMIN }}" --password="${{ secrets.TH_DB_PASSWD }}" --url="${{ env.TH_AURORA_MYSQLURL }}" update test: needs: [deploy-ephemeral-cloud-infra, init-mysql, setup] From 6fb4e90d51b6761f993bfdd9a650cbe388f3836d Mon Sep 17 00:00:00 2001 From: jandroav Date: Sat, 1 Jun 2024 20:07:11 +0200 Subject: [PATCH 23/37] =?UTF-8?q?=F0=9F=94=A7=20(aws-weekly.yml):=20add=20?= =?UTF-8?q?conditional=20database=20initialization=20step=20for=20AWS=20an?= =?UTF-8?q?d=20Aurora=20versions=20using=20Liquibase?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/aws-weekly.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/aws-weekly.yml b/.github/workflows/aws-weekly.yml index e7e05e1b3..14768133b 100644 --- a/.github/workflows/aws-weekly.yml +++ b/.github/workflows/aws-weekly.yml @@ -104,7 +104,13 @@ jobs: - name: Install Dependencies run: lpm update && lpm add mysql + - name: Init Database + if: ${{ matrix.version == 'aws' && matrix.database == 'mysql'}} + run: liquibase --classpath="src/test/resources/init-changelogs/aws" --changeLogFile="${{ matrix.database }}_cloud.sql" --username="${{ secrets.TH_DB_ADMIN }}" --password="${{ secrets.TH_DB_PASSWD }}" --url="${{ env.TH_MYSQLURL_8_0 }}" update + - name: Init Database + if: ${{ matrix.version == 'aurora' && matrix.database == 'mysql'}} + run: liquibase --classpath="src/test/resources/init-changelogs/aws" --changeLogFile="${{ matrix.database }}_cloud.sql" --username="${{ secrets.TH_DB_ADMIN }}" --password="${{ secrets.TH_DB_PASSWD }}" --url="${{ env.TH_AURORA_MYSQLURL }}" update test: needs: [deploy-ephemeral-cloud-infra, init-mysql, setup] From 4508e0a4b0d3d9737c1c4bd13e8551b8027e2c3a Mon Sep 17 00:00:00 2001 From: jandroav Date: Sat, 1 Jun 2024 20:15:09 +0200 Subject: [PATCH 24/37] =?UTF-8?q?=F0=9F=94=A7=20(aws-weekly.yml):=20remove?= =?UTF-8?q?=20unnecessary=20database=20initialization=20steps=20for=20mysq?= =?UTF-8?q?l=20due=20to=20mysql=20driver=20issue=20on=20GitHub=20actions.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/aws-weekly.yml | 9 --------- 1 file changed, 9 deletions(-) diff --git a/.github/workflows/aws-weekly.yml b/.github/workflows/aws-weekly.yml index 14768133b..cf140564d 100644 --- a/.github/workflows/aws-weekly.yml +++ b/.github/workflows/aws-weekly.yml @@ -101,16 +101,7 @@ jobs: TH_AURORA_MYSQLURL, /testautomation/db_details/aurora_mysql_jdbc_${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} #This additional init step is required because of mysql driver issue on GH actions - - name: Install Dependencies - run: lpm update && lpm add mysql - - name: Init Database - if: ${{ matrix.version == 'aws' && matrix.database == 'mysql'}} - run: liquibase --classpath="src/test/resources/init-changelogs/aws" --changeLogFile="${{ matrix.database }}_cloud.sql" --username="${{ secrets.TH_DB_ADMIN }}" --password="${{ secrets.TH_DB_PASSWD }}" --url="${{ env.TH_MYSQLURL_8_0 }}" update - - - name: Init Database - if: ${{ matrix.version == 'aurora' && matrix.database == 'mysql'}} - run: liquibase --classpath="src/test/resources/init-changelogs/aws" --changeLogFile="${{ matrix.database }}_cloud.sql" --username="${{ secrets.TH_DB_ADMIN }}" --password="${{ secrets.TH_DB_PASSWD }}" --url="${{ env.TH_AURORA_MYSQLURL }}" update test: needs: [deploy-ephemeral-cloud-infra, init-mysql, setup] From 03411df06d0e4782570cad348427ca64e321895b Mon Sep 17 00:00:00 2001 From: jandroav Date: Sat, 1 Jun 2024 20:38:54 +0200 Subject: [PATCH 25/37] =?UTF-8?q?=F0=9F=94=A7=20(aws-weekly.yml):=20Remove?= =?UTF-8?q?=20redundant=20AWS=20secrets=20retrieval=20steps=20for=20MySQL?= =?UTF-8?q?=20databases=20and=20unnecessary=20comment=20to=20streamline=20?= =?UTF-8?q?workflow=20and=20improve=20readability.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/aws-weekly.yml | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/.github/workflows/aws-weekly.yml b/.github/workflows/aws-weekly.yml index cf140564d..f55c6e6bf 100644 --- a/.github/workflows/aws-weekly.yml +++ b/.github/workflows/aws-weekly.yml @@ -86,22 +86,6 @@ jobs: core.setOutput("databasePlatform", splitValues[0]); core.setOutput("databaseVersion", splitValues[1]); - - name: Get AWS secrets - if: ${{ matrix.version == 'aws' && matrix.database == 'mysql'}} - uses: aws-actions/aws-secretsmanager-get-secrets@v2 - with: - secret-ids: | - TH_MYSQLURL_8_0, /testautomation/db_details/aws_mysql_jdbc_${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} - - - name: Get AWS secrets - if: ${{ matrix.version == 'aurora' && matrix.database == 'mysql'}} - uses: aws-actions/aws-secretsmanager-get-secrets@v2 - with: - secret-ids: | - TH_AURORA_MYSQLURL, /testautomation/db_details/aurora_mysql_jdbc_${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} - - #This additional init step is required because of mysql driver issue on GH actions - test: needs: [deploy-ephemeral-cloud-infra, init-mysql, setup] From b173feb8e6d991d09675f8771eda947749665ceb Mon Sep 17 00:00:00 2001 From: jandroav Date: Sat, 1 Jun 2024 21:15:47 +0200 Subject: [PATCH 26/37] =?UTF-8?q?=E2=9C=A8=20(aws-weekly.yml):=20Add=20a?= =?UTF-8?q?=20new=20line=20to=20improve=20readability=20and=20maintain=20c?= =?UTF-8?q?onsistency=20in=20the=20workflow=20file=20=F0=9F=93=9D=20(mssql?= =?UTF-8?q?.sql):=20Add=20database=20creation=20and=20switching=20commands?= =?UTF-8?q?=20for=20better=20database=20management=20and=20setup?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/aws-weekly.yml | 1 + src/test/resources/init-changelogs/aws/mssql.sql | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/.github/workflows/aws-weekly.yml b/.github/workflows/aws-weekly.yml index f55c6e6bf..4e2668b34 100644 --- a/.github/workflows/aws-weekly.yml +++ b/.github/workflows/aws-weekly.yml @@ -87,6 +87,7 @@ jobs: core.setOutput("databaseVersion", splitValues[1]); + test: needs: [deploy-ephemeral-cloud-infra, init-mysql, setup] permissions: diff --git a/src/test/resources/init-changelogs/aws/mssql.sql b/src/test/resources/init-changelogs/aws/mssql.sql index a084154db..f12c74b9a 100644 --- a/src/test/resources/init-changelogs/aws/mssql.sql +++ b/src/test/resources/init-changelogs/aws/mssql.sql @@ -1,5 +1,9 @@ --liquibase formatted sql --changeset liquibase:1 runAlways:true +USE master; +CREATE DATABASE lbcat; +GO +USE NewDB; DROP TABLE IF EXISTS [dbo].[authors] CREATE TABLE [dbo].[authors]( [id] [int] NOT NULL, From 557f89c24ae5964027aa6d6a5d5d9378e7d02c0a Mon Sep 17 00:00:00 2001 From: jandroav Date: Sun, 2 Jun 2024 06:32:15 +0200 Subject: [PATCH 27/37] test --- .github/workflows/aws-weekly.yml | 31 +- .github/workflows/aws-weekly_ok.yml | 317 ++++++++++++++++++ .../resources/init-changelogs/aws/mssql.sql | 4 +- 3 files changed, 330 insertions(+), 22 deletions(-) create mode 100644 .github/workflows/aws-weekly_ok.yml diff --git a/.github/workflows/aws-weekly.yml b/.github/workflows/aws-weekly.yml index 4e2668b34..01b0ebaaf 100644 --- a/.github/workflows/aws-weekly.yml +++ b/.github/workflows/aws-weekly.yml @@ -23,14 +23,14 @@ on: databases: description: Databases to start up. Comma separated list of "name:version" required: true - default: "[\"postgresql:12\",\"postgresql:13\",\"postgresql:14\",\"oracle:aws_19\",\"mariadb:aws_10.6\",\"mysql:aws\",\"mysql:aurora\",\"mssql:2019\",\"postgresql:aurora\"]" + default: "[\"mssql:2019\"]" jobs: setup: name: Setup runs-on: ubuntu-latest outputs: - databases: ${{ github.event.inputs.databases || '["postgresql:12","postgresql:13","postgresql:14","oracle:aws_19","mariadb:aws_10.6","mysql:aws","mysql:aurora","mssql:2019","postgresql:aurora"]' }} + databases: ${{ github.event.inputs.databases || '["mssql:2019"]' }} testClasses: ${{ inputs.testClasses || 'LiquibaseHarnessSuiteTest' }} steps: - name: Checkout @@ -86,8 +86,6 @@ jobs: core.setOutput("databasePlatform", splitValues[0]); core.setOutput("databaseVersion", splitValues[1]); - - test: needs: [deploy-ephemeral-cloud-infra, init-mysql, setup] permissions: @@ -200,6 +198,16 @@ jobs: password: "${{secrets.TH_DB_PASSWD}}" url: "${{ env.TH_MARIADBURL_10_6 }}" + - name: Install a SQL Server suite of tools + if: ${{ steps.setup.outputs.databasePlatform == 'mssql' }} + uses: potatoqualitee/mssqlsuite@v1.7 + with: + install: sqlengine, sqlclient, sqlpackage + + - name: Run sqlcmd + if: ${{ steps.setup.outputs.databasePlatform == 'mssql' }} + run: sqlcmd -S ${{ env.TH_MSSQLURL }} -U ${{secrets.TH_DB_ADMIN}} -P ${{secrets.TH_DB_PASSWD}} -d tempdb -Q "CREATE DATABASE lbcat" + - uses: liquibase/liquibase-github-action@v7 if: ${{ steps.setup.outputs.databasePlatform == 'mssql' }} with: @@ -276,18 +284,3 @@ jobs: name: aws-rds-${{ steps.setup.outputs.databasePlatform }}-${{ steps.setup.outputs.databaseVersion }}-test-results path: build/spock-reports - destroy-ephemeral-cloud-infra: - if: always() - needs: [ deploy-ephemeral-cloud-infra, test ] - uses: liquibase/build-logic/.github/workflows/ephemeral-cloud-infra.yml@DAT-17834 - secrets: inherit - with: - destroy: true - stack_id: ${{ needs.deploy-ephemeral-cloud-infra.outputs.stack_id }} - aws_postgresql: ${{ contains(inputs.databases, 'postgresql:12') || contains(inputs.databases, 'postgresql:13') || contains(inputs.databases, 'postgresql:14')}} - aws_oracle: ${{ contains(inputs.databases, 'oracle') }} - aws_mariadb: ${{ contains(inputs.databases, 'mariadb') }} - aws_aurora_mysql: ${{ contains(inputs.databases, 'mysql:aurora') }} - aws_mssql: ${{ contains(inputs.databases, 'mssql') }} - aws_aurora_postgres: ${{ contains(inputs.databases, 'postgresql:aurora') }} - aws_mysql: ${{ contains(inputs.databases, 'mysql:aws') }} diff --git a/.github/workflows/aws-weekly_ok.yml b/.github/workflows/aws-weekly_ok.yml new file mode 100644 index 000000000..14768133b --- /dev/null +++ b/.github/workflows/aws-weekly_ok.yml @@ -0,0 +1,317 @@ +# Terraform Action to test Cloud Databases with test-harness + +name: AWS Weekly Cloud Database Test Execution +on: + # Triggers the workflow on a schedule for the main branch. Also allows for manual triggers + # Execute every sunday at 4:00 AM + schedule: + - cron: '0 4 * * 0' + workflow_dispatch: + inputs: + testClasses: + type: choice + description: Test Suite or test class to run + options: + - LiquibaseHarnessSuiteTest + - FoundationalHarnessSuiteTest + - AdvancedHarnessSuiteTest + - ChangeObjectTests + - ChangeDataTests + - SnapshotObjectTests + - GenerateChangelogTest + - FoundationalTest + databases: + description: Databases to start up. Comma separated list of "name:version" + required: true + default: "[\"postgresql:12\",\"postgresql:13\",\"postgresql:14\",\"oracle:aws_19\",\"mariadb:aws_10.6\",\"mysql:aws\",\"mysql:aurora\",\"mssql:2019\",\"postgresql:aurora\"]" + +jobs: + setup: + name: Setup + runs-on: ubuntu-latest + outputs: + databases: ${{ github.event.inputs.databases || '["postgresql:12","postgresql:13","postgresql:14","oracle:aws_19","mariadb:aws_10.6","mysql:aws","mysql:aurora","mssql:2019","postgresql:aurora"]' }} + testClasses: ${{ inputs.testClasses || 'LiquibaseHarnessSuiteTest' }} + steps: + - name: Checkout + uses: actions/checkout@v4 + + deploy-ephemeral-cloud-infra: + uses: liquibase/build-logic/.github/workflows/ephemeral-cloud-infra.yml@DAT-17834 + secrets: inherit + with: + deploy: true + aws_postgresql: ${{ contains(inputs.databases, 'postgresql:12') || contains(inputs.databases, 'postgresql:13') || contains(inputs.databases, 'postgresql:14')}} + aws_oracle: ${{ contains(inputs.databases, 'oracle') }} + aws_mariadb: ${{ contains(inputs.databases, 'mariadb') }} + aws_aurora_mysql: ${{ contains(inputs.databases, 'mysql:aurora') }} + aws_mssql: ${{ contains(inputs.databases, 'mssql') }} + aws_aurora_postgres: ${{ contains(inputs.databases, 'postgresql:aurora') }} + aws_mysql: ${{ contains(inputs.databases, 'mysql:aws') }} + + init-mysql: + runs-on: ubuntu-latest + needs: [deploy-ephemeral-cloud-infra] + permissions: + contents: read + id-token: write + container: + image: liquibase/liquibase:latest + env: + LIQUIBASE_PRO_LICENSE_KEY: ${{ secrets.LICENSE_KEY }} + strategy: + fail-fast: false + matrix: + include: + - database: mysql + version: aws + - database: mysql + version: aurora + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v4 + with: + role-to-assume: ${{ secrets.AWS_DEV_GITHUB_OIDC_ROLE_ARN_BUILD_LOGIC }} + aws-region: us-east-1 + + - name: Configure Test + id: setup + uses: actions/github-script@v7.0.1 + with: + script: | + let splitValues = "${{ matrix.database }}".split(":") + core.setOutput("databasePlatform", splitValues[0]); + core.setOutput("databaseVersion", splitValues[1]); + + - name: Get AWS secrets + if: ${{ matrix.version == 'aws' && matrix.database == 'mysql'}} + uses: aws-actions/aws-secretsmanager-get-secrets@v2 + with: + secret-ids: | + TH_MYSQLURL_8_0, /testautomation/db_details/aws_mysql_jdbc_${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} + + - name: Get AWS secrets + if: ${{ matrix.version == 'aurora' && matrix.database == 'mysql'}} + uses: aws-actions/aws-secretsmanager-get-secrets@v2 + with: + secret-ids: | + TH_AURORA_MYSQLURL, /testautomation/db_details/aurora_mysql_jdbc_${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} + + #This additional init step is required because of mysql driver issue on GH actions + - name: Install Dependencies + run: lpm update && lpm add mysql + + - name: Init Database + if: ${{ matrix.version == 'aws' && matrix.database == 'mysql'}} + run: liquibase --classpath="src/test/resources/init-changelogs/aws" --changeLogFile="${{ matrix.database }}_cloud.sql" --username="${{ secrets.TH_DB_ADMIN }}" --password="${{ secrets.TH_DB_PASSWD }}" --url="${{ env.TH_MYSQLURL_8_0 }}" update + + - name: Init Database + if: ${{ matrix.version == 'aurora' && matrix.database == 'mysql'}} + run: liquibase --classpath="src/test/resources/init-changelogs/aws" --changeLogFile="${{ matrix.database }}_cloud.sql" --username="${{ secrets.TH_DB_ADMIN }}" --password="${{ secrets.TH_DB_PASSWD }}" --url="${{ env.TH_AURORA_MYSQLURL }}" update + + test: + needs: [deploy-ephemeral-cloud-infra, init-mysql, setup] + permissions: + contents: read + id-token: write + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + database: ${{ fromJson(needs.setup.outputs.databases) }} + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Configure Test + id: setup + uses: actions/github-script@v7.0.1 + with: + script: | + let splitValues = "${{ matrix.database }}".split(":") + core.setOutput("databasePlatform", splitValues[0]); + core.setOutput("databaseVersion", splitValues[1]); + + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v4 + with: + role-to-assume: ${{ secrets.AWS_DEV_GITHUB_OIDC_ROLE_ARN_BUILD_LOGIC }} + aws-region: us-east-1 + + - name: Get AWS secrets + if: ${{ steps.setup.outputs.databasePlatform == 'mysql' && steps.setup.outputs.databaseVersion == 'aws' }} + uses: aws-actions/aws-secretsmanager-get-secrets@v2 + with: + secret-ids: | + TH_MYSQLURL_8_0, /testautomation/db_details/aws_mysql_jdbc_${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} + + - name: Get AWS secrets + if: ${{ steps.setup.outputs.databasePlatform == 'mysql' && steps.setup.outputs.databaseVersion == 'aurora' }} + uses: aws-actions/aws-secretsmanager-get-secrets@v2 + with: + secret-ids: | + TH_AURORA_MYSQLURL, /testautomation/db_details/aurora_mysql_jdbc_${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} + + + - name: Get AWS secrets + if: ${{ steps.setup.outputs.databasePlatform == 'oracle' }} + uses: aws-actions/aws-secretsmanager-get-secrets@v2 + with: + secret-ids: | + TH_ORACLEURL_19, /testautomation/db_details/aws_oracle_19_jdbc_${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} + + - name: Get AWS secrets + if: ${{ steps.setup.outputs.databasePlatform == 'postgresql' && steps.setup.outputs.databaseVersion != 'aurora' }} + uses: aws-actions/aws-secretsmanager-get-secrets@v2 + with: + secret-ids: | + TH_PGRESURL_12, /testautomation/db_details/aws_postgresql_12_jdbc_${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} + TH_PGRESURL_13, /testautomation/db_details/aws_postgresql_13_jdbc_${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} + TH_PGRESURL_14, /testautomation/db_details/aws_postgresql_14_jdbc_${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} + + - name: Get AWS secrets + if: ${{ steps.setup.outputs.databasePlatform == 'mariadb' }} + uses: aws-actions/aws-secretsmanager-get-secrets@v2 + with: + secret-ids: | + TH_MARIADBURL_10_6, /testautomation/db_details/aws_mariadb_jdbc_${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} + + - name: Get AWS secrets + if: ${{ steps.setup.outputs.databasePlatform == 'mssql' }} + uses: aws-actions/aws-secretsmanager-get-secrets@v2 + with: + secret-ids: | + TH_MSSQLURL, /testautomation/db_details/aws_mssql_jdbc_${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} + + - name: Get AWS secrets + if: ${{ steps.setup.outputs.databasePlatform == 'postgresql' && steps.setup.outputs.databaseVersion == 'aurora' }} + uses: aws-actions/aws-secretsmanager-get-secrets@v2 + with: + secret-ids: | + TH_AURORA_POSTGRESQLURL, /testautomation/db_details/aurora_postgresql_jdbc_${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} + + - uses: liquibase/liquibase-github-action@v7 + if: ${{ steps.setup.outputs.databasePlatform == 'oracle' }} + with: + operation: "update" + classpath: "src/test/resources/init-changelogs/aws" + changeLogFile: "oracle.sql" + username: "${{secrets.TH_DB_ADMIN}}" + password: "${{secrets.TH_DB_PASSWD}}" + url: "${{ env.TH_ORACLEURL_19 }}" + + - uses: liquibase/liquibase-github-action@v7 + if: ${{ steps.setup.outputs.databasePlatform == 'postgresql' && steps.setup.outputs.databaseVersion != 'aurora' }} + with: + operation: "update" + classpath: "src/test/resources/init-changelogs/aws" + changeLogFile: "postgresql.sql" + username: "${{secrets.TH_DB_ADMIN}}" + password: "${{secrets.TH_DB_PASSWD}}" + url: "${{ env[format('TH_PGRESURL_{0}', steps.setup.outputs.databaseVersion)] }}" + + - uses: liquibase/liquibase-github-action@v7 + if: ${{ steps.setup.outputs.databasePlatform == 'mariadb' }} + with: + operation: "update" + classpath: "src/test/resources/init-changelogs/aws" + changeLogFile: "mariadb.sql" + username: "${{secrets.TH_DB_ADMIN}}" + password: "${{secrets.TH_DB_PASSWD}}" + url: "${{ env.TH_MARIADBURL_10_6 }}" + + - uses: liquibase/liquibase-github-action@v7 + if: ${{ steps.setup.outputs.databasePlatform == 'mssql' }} + with: + operation: "update" + classpath: "src/test/resources/init-changelogs/aws" + changeLogFile: "mssql.sql" + username: "${{secrets.TH_DB_ADMIN}}" + password: "${{secrets.TH_DB_PASSWD}}" + url: "${{ env.TH_MSSQLURL }}" + + - uses: liquibase/liquibase-github-action@v7 + if: ${{ steps.setup.outputs.databasePlatform == 'postgresql' && steps.setup.outputs.databaseVersion == 'aurora' }} + with: + operation: "update" + classpath: "src/test/resources/init-changelogs/aws" + changeLogFile: "postgresql.sql" + username: "${{secrets.TH_DB_ADMIN}}" + password: "${{secrets.TH_DB_PASSWD}}" + url: "${{ env.TH_AURORA_POSTGRESQLURL }}" + + - name: Cache local Maven repository + uses: actions/cache@v3 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} + restore-keys: | + ${{ runner.os }}-maven- + + - name: AWS RDS ${{ steps.setup.outputs.databasePlatform }}-${{ steps.setup.outputs.databaseVersion }} Test Run + if: ${{ steps.setup.outputs.databasePlatform == 'postgresql' && steps.setup.outputs.databaseVersion != 'aurora' }} + env: + LIQUIBASE_PRO_LICENSE_KEY: ${{ secrets.LICENSE_KEY }} + run: mvn -Dtest=${{ needs.setup.outputs.testClasses }} -DconfigFile=/harness-config-cloud.yml -DdbName=${{ steps.setup.outputs.databasePlatform }} -DdbVersion=${{ steps.setup.outputs.databaseVersion }} -Dprefix=aws -DdbUsername=${{secrets.TH_DB_ADMIN}} -DdbPassword=${{secrets.TH_DB_PASSWD}} -DdbUrl='${{ env[format('TH_PGRESURL_{0}', steps.setup.outputs.databaseVersion)] }}' test + + - name: AWS RDS ${{ steps.setup.outputs.databasePlatform }}-${{ steps.setup.outputs.databaseVersion }} Test Run + if: ${{ steps.setup.outputs.databasePlatform == 'oracle' }} + env: + LIQUIBASE_PRO_LICENSE_KEY: ${{ secrets.LICENSE_KEY }} + run: mvn -Dtest=${{ needs.setup.outputs.testClasses }} -DconfigFile=/harness-config-cloud.yml -DdbName=${{ steps.setup.outputs.databasePlatform }} -DdbVersion=${{ steps.setup.outputs.databaseVersion }} -DdbUsername=${{secrets.TH_DB_ADMIN}} -DdbPassword=${{secrets.TH_DB_PASSWD}} -DdbUrl='${{ env.TH_ORACLEURL_19 }}' test + + - name: AWS RDS ${{ steps.setup.outputs.databasePlatform }}-${{ steps.setup.outputs.databaseVersion }} Test Run + if: ${{ steps.setup.outputs.databasePlatform == 'mariadb' }} + env: + LIQUIBASE_PRO_LICENSE_KEY: ${{ secrets.LICENSE_KEY }} + run: mvn -Dtest=${{ needs.setup.outputs.testClasses }} -DconfigFile=/harness-config-cloud.yml -DdbName=${{ steps.setup.outputs.databasePlatform }} -DdbVersion=${{ steps.setup.outputs.databaseVersion }} -DdbUsername=${{secrets.TH_DB_ADMIN}} -DdbPassword=${{secrets.TH_DB_PASSWD}} -DdbUrl='${{ env.TH_MARIADBURL_10_6 }}' test + + - name: AWS RDS ${{ steps.setup.outputs.databasePlatform }}-${{ steps.setup.outputs.databaseVersion }} Test Run + if: ${{ steps.setup.outputs.databasePlatform == 'mysql' && steps.setup.outputs.databaseVersion == 'aws' }} + env: + LIQUIBASE_PRO_LICENSE_KEY: ${{ secrets.LICENSE_KEY }} + run: mvn -Dtest=${{ needs.setup.outputs.testClasses }} -DconfigFile=/harness-config-cloud.yml -DdbName=${{ steps.setup.outputs.databasePlatform }} -DdbVersion=${{ steps.setup.outputs.databaseVersion }} -DdbUsername=${{secrets.TH_DB_ADMIN}} -DdbPassword=${{secrets.TH_DB_PASSWD}} -DdbUrl='${{ env.TH_MYSQLURL_8_0 }}' test + + - name: AWS RDS ${{ steps.setup.outputs.databasePlatform }}-${{ steps.setup.outputs.databaseVersion }} Test Run + if: ${{ steps.setup.outputs.databasePlatform == 'mssql' }} + env: + LIQUIBASE_PRO_LICENSE_KEY: ${{ secrets.LICENSE_KEY }} + run: mvn -Dtest=${{ needs.setup.outputs.testClasses }} -DconfigFile=/harness-config-cloud.yml -DdbName=${{ steps.setup.outputs.databasePlatform }} -DdbVersion=${{ steps.setup.outputs.databaseVersion }} -DdbUsername=${{secrets.TH_DB_ADMIN}} -DdbPassword=${{secrets.TH_DB_PASSWD}} -DdbUrl='${{ env.TH_MSSQLURL }}' test + + - name: AWS Aurora ${{ steps.setup.outputs.databasePlatform }} Test Run + if: ${{ steps.setup.outputs.databasePlatform == 'mysql' && steps.setup.outputs.databaseVersion == 'aurora' }} + env: + LIQUIBASE_PRO_LICENSE_KEY: ${{ secrets.LICENSE_KEY }} + run: mvn -Dtest=${{ needs.setup.outputs.testClasses }} -DconfigFile=/harness-config-cloud.yml -DdbName=${{ steps.setup.outputs.databasePlatform }} -DdbVersion=${{ steps.setup.outputs.databaseVersion }} -DdbUsername=${{secrets.TH_DB_ADMIN}} -DdbPassword=${{secrets.TH_DB_PASSWD}} -DdbUrl='${{ env.TH_AURORA_MYSQLURL }}' test + + - name: AWS Aurora ${{ steps.setup.outputs.databasePlatform }} Test Run + if: ${{ steps.setup.outputs.databasePlatform == 'postgresql' && steps.setup.outputs.databaseVersion == 'aurora' }} + env: + LIQUIBASE_PRO_LICENSE_KEY: ${{ secrets.LICENSE_KEY }} + run: mvn -Dtest=${{ needs.setup.outputs.testClasses }} -DconfigFile=/harness-config-cloud.yml -DdbName=${{ steps.setup.outputs.databasePlatform }} -DdbVersion=13 -Dprefix=aurora -DdbUsername=${{secrets.TH_DB_ADMIN}} -DdbPassword=${{secrets.TH_DB_PASSWD}} -DdbUrl='${{ env.TH_AURORA_POSTGRESQLURL }}' test + + - name: Archive AWS RDS ${{ steps.setup.outputs.databasePlatform }}-${{ steps.setup.outputs.databaseVersion }} Test Results + uses: actions/upload-artifact@v4 + with: + name: aws-rds-${{ steps.setup.outputs.databasePlatform }}-${{ steps.setup.outputs.databaseVersion }}-test-results + path: build/spock-reports + + destroy-ephemeral-cloud-infra: + if: always() + needs: [ deploy-ephemeral-cloud-infra, test ] + uses: liquibase/build-logic/.github/workflows/ephemeral-cloud-infra.yml@DAT-17834 + secrets: inherit + with: + destroy: true + stack_id: ${{ needs.deploy-ephemeral-cloud-infra.outputs.stack_id }} + aws_postgresql: ${{ contains(inputs.databases, 'postgresql:12') || contains(inputs.databases, 'postgresql:13') || contains(inputs.databases, 'postgresql:14')}} + aws_oracle: ${{ contains(inputs.databases, 'oracle') }} + aws_mariadb: ${{ contains(inputs.databases, 'mariadb') }} + aws_aurora_mysql: ${{ contains(inputs.databases, 'mysql:aurora') }} + aws_mssql: ${{ contains(inputs.databases, 'mssql') }} + aws_aurora_postgres: ${{ contains(inputs.databases, 'postgresql:aurora') }} + aws_mysql: ${{ contains(inputs.databases, 'mysql:aws') }} diff --git a/src/test/resources/init-changelogs/aws/mssql.sql b/src/test/resources/init-changelogs/aws/mssql.sql index f12c74b9a..fe82bc7a5 100644 --- a/src/test/resources/init-changelogs/aws/mssql.sql +++ b/src/test/resources/init-changelogs/aws/mssql.sql @@ -1,9 +1,7 @@ --liquibase formatted sql --changeset liquibase:1 runAlways:true -USE master; -CREATE DATABASE lbcat; +USE [lbcat] GO -USE NewDB; DROP TABLE IF EXISTS [dbo].[authors] CREATE TABLE [dbo].[authors]( [id] [int] NOT NULL, From 9dc8636f7f6d00a3ad2f2a9b93444fe694248b98 Mon Sep 17 00:00:00 2001 From: jandroav Date: Sun, 2 Jun 2024 06:44:02 +0200 Subject: [PATCH 28/37] =?UTF-8?q?=F0=9F=94=A7=20(aws-weekly.yml):=20add=20?= =?UTF-8?q?TH=5FMSSQLURL=5FHOST=20secret=20to=20support=20MSSQL=20host=20c?= =?UTF-8?q?onfiguration=20for=20sqlcmd=20execution?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/aws-weekly.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/aws-weekly.yml b/.github/workflows/aws-weekly.yml index 01b0ebaaf..0604c8623 100644 --- a/.github/workflows/aws-weekly.yml +++ b/.github/workflows/aws-weekly.yml @@ -160,6 +160,7 @@ jobs: with: secret-ids: | TH_MSSQLURL, /testautomation/db_details/aws_mssql_jdbc_${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} + TH_MSSQLURL_HOST, /testautomation/db_details/aws_mssql_host${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} - name: Get AWS secrets if: ${{ steps.setup.outputs.databasePlatform == 'postgresql' && steps.setup.outputs.databaseVersion == 'aurora' }} @@ -206,7 +207,7 @@ jobs: - name: Run sqlcmd if: ${{ steps.setup.outputs.databasePlatform == 'mssql' }} - run: sqlcmd -S ${{ env.TH_MSSQLURL }} -U ${{secrets.TH_DB_ADMIN}} -P ${{secrets.TH_DB_PASSWD}} -d tempdb -Q "CREATE DATABASE lbcat" + run: sqlcmd -S ${{ env.TH_MSSQLURL_HOST }} -U ${{secrets.TH_DB_ADMIN}} -P ${{secrets.TH_DB_PASSWD}} -Q "CREATE DATABASE lbcat" - uses: liquibase/liquibase-github-action@v7 if: ${{ steps.setup.outputs.databasePlatform == 'mssql' }} From d82b8ffa7fd0875b898916cb5b755b85171c91c5 Mon Sep 17 00:00:00 2001 From: jandroav Date: Sun, 2 Jun 2024 07:05:06 +0200 Subject: [PATCH 29/37] =?UTF-8?q?=F0=9F=94=A7=20(aws-weekly.yml):=20update?= =?UTF-8?q?=20TH=5FMSSQLURL=5FHOST=20secret=20to=20include=20correct=20res?= =?UTF-8?q?ource=20ID=20for=20MSSQL=20host=20configuration?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/aws-weekly.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/aws-weekly.yml b/.github/workflows/aws-weekly.yml index 0604c8623..177ee0fb1 100644 --- a/.github/workflows/aws-weekly.yml +++ b/.github/workflows/aws-weekly.yml @@ -160,7 +160,7 @@ jobs: with: secret-ids: | TH_MSSQLURL, /testautomation/db_details/aws_mssql_jdbc_${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} - TH_MSSQLURL_HOST, /testautomation/db_details/aws_mssql_host${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} + TH_MSSQLURL_HOST, /testautomation/db_details/aws_mssql_host_${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} - name: Get AWS secrets if: ${{ steps.setup.outputs.databasePlatform == 'postgresql' && steps.setup.outputs.databaseVersion == 'aurora' }} From bcf5c8038b6c4eb0d7a8f0a23672aacbe49b824d Mon Sep 17 00:00:00 2001 From: jandroav Date: Sun, 2 Jun 2024 07:19:10 +0200 Subject: [PATCH 30/37] =?UTF-8?q?=F0=9F=94=A7=20(aws-weekly.yml):=20transf?= =?UTF-8?q?orm=20TH=5FMSSQLURL=5FHOST=20value=20to=20replace=20colon=20wit?= =?UTF-8?q?h=20comma=20for=20sqlcmd=20connection=20=F0=9F=94=A7=20(mssql.s?= =?UTF-8?q?ql):=20remove=20explicit=20USE=20[lbcat]=20statement=20as=20the?= =?UTF-8?q?=20database=20is=20now=20created=20dynamically=20during=20workf?= =?UTF-8?q?low=20execution?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/aws-weekly.yml | 7 ++++++- src/test/resources/init-changelogs/aws/mssql.sql | 2 -- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/aws-weekly.yml b/.github/workflows/aws-weekly.yml index 177ee0fb1..99505485b 100644 --- a/.github/workflows/aws-weekly.yml +++ b/.github/workflows/aws-weekly.yml @@ -207,7 +207,12 @@ jobs: - name: Run sqlcmd if: ${{ steps.setup.outputs.databasePlatform == 'mssql' }} - run: sqlcmd -S ${{ env.TH_MSSQLURL_HOST }} -U ${{secrets.TH_DB_ADMIN}} -P ${{secrets.TH_DB_PASSWD}} -Q "CREATE DATABASE lbcat" + run: | + original_value="${{ env.TH_MSSQLURL_HOST }}" + transformed_value="${original_value/:/,}" + echo "Transformed value: $transformed_value" + echo "TH_MSSQLURL_HOST_TRANSFORMED=$transformed_value" >> $GITHUB_ENV + sqlcmd -S ${{ env.TH_MSSQLURL_HOST_TRANSFORMED }} -U ${{secrets.TH_DB_ADMIN}} -P ${{secrets.TH_DB_PASSWD}} -Q "CREATE DATABASE lbcat" - uses: liquibase/liquibase-github-action@v7 if: ${{ steps.setup.outputs.databasePlatform == 'mssql' }} diff --git a/src/test/resources/init-changelogs/aws/mssql.sql b/src/test/resources/init-changelogs/aws/mssql.sql index fe82bc7a5..a084154db 100644 --- a/src/test/resources/init-changelogs/aws/mssql.sql +++ b/src/test/resources/init-changelogs/aws/mssql.sql @@ -1,7 +1,5 @@ --liquibase formatted sql --changeset liquibase:1 runAlways:true -USE [lbcat] -GO DROP TABLE IF EXISTS [dbo].[authors] CREATE TABLE [dbo].[authors]( [id] [int] NOT NULL, From a9105d27f71f9adbb36bb4831e5a94e2caf9b891 Mon Sep 17 00:00:00 2001 From: jandroav Date: Sun, 2 Jun 2024 07:40:17 +0200 Subject: [PATCH 31/37] =?UTF-8?q?=F0=9F=94=A7=20(aws-weekly.yml):=20simpli?= =?UTF-8?q?fy=20sqlcmd=20command=20by=20removing=20unnecessary=20variable?= =?UTF-8?q?=20transformation=20and=20echo=20statements?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/aws-weekly.yml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.github/workflows/aws-weekly.yml b/.github/workflows/aws-weekly.yml index 99505485b..177ee0fb1 100644 --- a/.github/workflows/aws-weekly.yml +++ b/.github/workflows/aws-weekly.yml @@ -207,12 +207,7 @@ jobs: - name: Run sqlcmd if: ${{ steps.setup.outputs.databasePlatform == 'mssql' }} - run: | - original_value="${{ env.TH_MSSQLURL_HOST }}" - transformed_value="${original_value/:/,}" - echo "Transformed value: $transformed_value" - echo "TH_MSSQLURL_HOST_TRANSFORMED=$transformed_value" >> $GITHUB_ENV - sqlcmd -S ${{ env.TH_MSSQLURL_HOST_TRANSFORMED }} -U ${{secrets.TH_DB_ADMIN}} -P ${{secrets.TH_DB_PASSWD}} -Q "CREATE DATABASE lbcat" + run: sqlcmd -S ${{ env.TH_MSSQLURL_HOST }} -U ${{secrets.TH_DB_ADMIN}} -P ${{secrets.TH_DB_PASSWD}} -Q "CREATE DATABASE lbcat" - uses: liquibase/liquibase-github-action@v7 if: ${{ steps.setup.outputs.databasePlatform == 'mssql' }} From a8dbc67a5ce0dba67ad446e3f6c58eac37178085 Mon Sep 17 00:00:00 2001 From: jandroav Date: Sun, 2 Jun 2024 08:02:54 +0200 Subject: [PATCH 32/37] test --- .github/workflows/aws-weekly.yml | 45 +++- .github/workflows/aws-weekly_ok.yml | 317 ---------------------------- 2 files changed, 43 insertions(+), 319 deletions(-) delete mode 100644 .github/workflows/aws-weekly_ok.yml diff --git a/.github/workflows/aws-weekly.yml b/.github/workflows/aws-weekly.yml index 177ee0fb1..df6ccf018 100644 --- a/.github/workflows/aws-weekly.yml +++ b/.github/workflows/aws-weekly.yml @@ -23,14 +23,14 @@ on: databases: description: Databases to start up. Comma separated list of "name:version" required: true - default: "[\"mssql:2019\"]" + default: "[\"postgresql:12\",\"postgresql:13\",\"postgresql:14\",\"oracle:aws_19\",\"mariadb:aws_10.6\",\"mysql:aws\",\"mysql:aurora\",\"mssql:2019\",\"postgresql:aurora\"]" jobs: setup: name: Setup runs-on: ubuntu-latest outputs: - databases: ${{ github.event.inputs.databases || '["mssql:2019"]' }} + databases: ${{ github.event.inputs.databases || '["postgresql:12","postgresql:13","postgresql:14","oracle:aws_19","mariadb:aws_10.6","mysql:aws","mysql:aurora","mssql:2019","postgresql:aurora"]' }} testClasses: ${{ inputs.testClasses || 'LiquibaseHarnessSuiteTest' }} steps: - name: Checkout @@ -86,6 +86,32 @@ jobs: core.setOutput("databasePlatform", splitValues[0]); core.setOutput("databaseVersion", splitValues[1]); + - name: Get AWS secrets + if: ${{ matrix.version == 'aws' && matrix.database == 'mysql'}} + uses: aws-actions/aws-secretsmanager-get-secrets@v2 + with: + secret-ids: | + TH_MYSQLURL_8_0, /testautomation/db_details/aws_mysql_jdbc_${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} + + - name: Get AWS secrets + if: ${{ matrix.version == 'aurora' && matrix.database == 'mysql'}} + uses: aws-actions/aws-secretsmanager-get-secrets@v2 + with: + secret-ids: | + TH_AURORA_MYSQLURL, /testautomation/db_details/aurora_mysql_jdbc_${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} + + #This additional init step is required because of mysql driver issue on GH actions + - name: Install Dependencies + run: lpm update && lpm add mysql + + - name: Init Database + if: ${{ matrix.version == 'aws' && matrix.database == 'mysql'}} + run: liquibase --classpath="src/test/resources/init-changelogs/aws" --changeLogFile="${{ matrix.database }}_cloud.sql" --username="${{ secrets.TH_DB_ADMIN }}" --password="${{ secrets.TH_DB_PASSWD }}" --url="${{ env.TH_MYSQLURL_8_0 }}" update + + - name: Init Database + if: ${{ matrix.version == 'aurora' && matrix.database == 'mysql'}} + run: liquibase --classpath="src/test/resources/init-changelogs/aws" --changeLogFile="${{ matrix.database }}_cloud.sql" --username="${{ secrets.TH_DB_ADMIN }}" --password="${{ secrets.TH_DB_PASSWD }}" --url="${{ env.TH_AURORA_MYSQLURL }}" update + test: needs: [deploy-ephemeral-cloud-infra, init-mysql, setup] permissions: @@ -285,3 +311,18 @@ jobs: name: aws-rds-${{ steps.setup.outputs.databasePlatform }}-${{ steps.setup.outputs.databaseVersion }}-test-results path: build/spock-reports + destroy-ephemeral-cloud-infra: + if: always() + needs: [ deploy-ephemeral-cloud-infra, test ] + uses: liquibase/build-logic/.github/workflows/ephemeral-cloud-infra.yml@DAT-17834 + secrets: inherit + with: + destroy: true + stack_id: ${{ needs.deploy-ephemeral-cloud-infra.outputs.stack_id }} + aws_postgresql: ${{ contains(inputs.databases, 'postgresql:12') || contains(inputs.databases, 'postgresql:13') || contains(inputs.databases, 'postgresql:14')}} + aws_oracle: ${{ contains(inputs.databases, 'oracle') }} + aws_mariadb: ${{ contains(inputs.databases, 'mariadb') }} + aws_aurora_mysql: ${{ contains(inputs.databases, 'mysql:aurora') }} + aws_mssql: ${{ contains(inputs.databases, 'mssql') }} + aws_aurora_postgres: ${{ contains(inputs.databases, 'postgresql:aurora') }} + aws_mysql: ${{ contains(inputs.databases, 'mysql:aws') }} diff --git a/.github/workflows/aws-weekly_ok.yml b/.github/workflows/aws-weekly_ok.yml deleted file mode 100644 index 14768133b..000000000 --- a/.github/workflows/aws-weekly_ok.yml +++ /dev/null @@ -1,317 +0,0 @@ -# Terraform Action to test Cloud Databases with test-harness - -name: AWS Weekly Cloud Database Test Execution -on: - # Triggers the workflow on a schedule for the main branch. Also allows for manual triggers - # Execute every sunday at 4:00 AM - schedule: - - cron: '0 4 * * 0' - workflow_dispatch: - inputs: - testClasses: - type: choice - description: Test Suite or test class to run - options: - - LiquibaseHarnessSuiteTest - - FoundationalHarnessSuiteTest - - AdvancedHarnessSuiteTest - - ChangeObjectTests - - ChangeDataTests - - SnapshotObjectTests - - GenerateChangelogTest - - FoundationalTest - databases: - description: Databases to start up. Comma separated list of "name:version" - required: true - default: "[\"postgresql:12\",\"postgresql:13\",\"postgresql:14\",\"oracle:aws_19\",\"mariadb:aws_10.6\",\"mysql:aws\",\"mysql:aurora\",\"mssql:2019\",\"postgresql:aurora\"]" - -jobs: - setup: - name: Setup - runs-on: ubuntu-latest - outputs: - databases: ${{ github.event.inputs.databases || '["postgresql:12","postgresql:13","postgresql:14","oracle:aws_19","mariadb:aws_10.6","mysql:aws","mysql:aurora","mssql:2019","postgresql:aurora"]' }} - testClasses: ${{ inputs.testClasses || 'LiquibaseHarnessSuiteTest' }} - steps: - - name: Checkout - uses: actions/checkout@v4 - - deploy-ephemeral-cloud-infra: - uses: liquibase/build-logic/.github/workflows/ephemeral-cloud-infra.yml@DAT-17834 - secrets: inherit - with: - deploy: true - aws_postgresql: ${{ contains(inputs.databases, 'postgresql:12') || contains(inputs.databases, 'postgresql:13') || contains(inputs.databases, 'postgresql:14')}} - aws_oracle: ${{ contains(inputs.databases, 'oracle') }} - aws_mariadb: ${{ contains(inputs.databases, 'mariadb') }} - aws_aurora_mysql: ${{ contains(inputs.databases, 'mysql:aurora') }} - aws_mssql: ${{ contains(inputs.databases, 'mssql') }} - aws_aurora_postgres: ${{ contains(inputs.databases, 'postgresql:aurora') }} - aws_mysql: ${{ contains(inputs.databases, 'mysql:aws') }} - - init-mysql: - runs-on: ubuntu-latest - needs: [deploy-ephemeral-cloud-infra] - permissions: - contents: read - id-token: write - container: - image: liquibase/liquibase:latest - env: - LIQUIBASE_PRO_LICENSE_KEY: ${{ secrets.LICENSE_KEY }} - strategy: - fail-fast: false - matrix: - include: - - database: mysql - version: aws - - database: mysql - version: aurora - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Configure AWS Credentials - uses: aws-actions/configure-aws-credentials@v4 - with: - role-to-assume: ${{ secrets.AWS_DEV_GITHUB_OIDC_ROLE_ARN_BUILD_LOGIC }} - aws-region: us-east-1 - - - name: Configure Test - id: setup - uses: actions/github-script@v7.0.1 - with: - script: | - let splitValues = "${{ matrix.database }}".split(":") - core.setOutput("databasePlatform", splitValues[0]); - core.setOutput("databaseVersion", splitValues[1]); - - - name: Get AWS secrets - if: ${{ matrix.version == 'aws' && matrix.database == 'mysql'}} - uses: aws-actions/aws-secretsmanager-get-secrets@v2 - with: - secret-ids: | - TH_MYSQLURL_8_0, /testautomation/db_details/aws_mysql_jdbc_${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} - - - name: Get AWS secrets - if: ${{ matrix.version == 'aurora' && matrix.database == 'mysql'}} - uses: aws-actions/aws-secretsmanager-get-secrets@v2 - with: - secret-ids: | - TH_AURORA_MYSQLURL, /testautomation/db_details/aurora_mysql_jdbc_${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} - - #This additional init step is required because of mysql driver issue on GH actions - - name: Install Dependencies - run: lpm update && lpm add mysql - - - name: Init Database - if: ${{ matrix.version == 'aws' && matrix.database == 'mysql'}} - run: liquibase --classpath="src/test/resources/init-changelogs/aws" --changeLogFile="${{ matrix.database }}_cloud.sql" --username="${{ secrets.TH_DB_ADMIN }}" --password="${{ secrets.TH_DB_PASSWD }}" --url="${{ env.TH_MYSQLURL_8_0 }}" update - - - name: Init Database - if: ${{ matrix.version == 'aurora' && matrix.database == 'mysql'}} - run: liquibase --classpath="src/test/resources/init-changelogs/aws" --changeLogFile="${{ matrix.database }}_cloud.sql" --username="${{ secrets.TH_DB_ADMIN }}" --password="${{ secrets.TH_DB_PASSWD }}" --url="${{ env.TH_AURORA_MYSQLURL }}" update - - test: - needs: [deploy-ephemeral-cloud-infra, init-mysql, setup] - permissions: - contents: read - id-token: write - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - database: ${{ fromJson(needs.setup.outputs.databases) }} - - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Configure Test - id: setup - uses: actions/github-script@v7.0.1 - with: - script: | - let splitValues = "${{ matrix.database }}".split(":") - core.setOutput("databasePlatform", splitValues[0]); - core.setOutput("databaseVersion", splitValues[1]); - - - name: Configure AWS Credentials - uses: aws-actions/configure-aws-credentials@v4 - with: - role-to-assume: ${{ secrets.AWS_DEV_GITHUB_OIDC_ROLE_ARN_BUILD_LOGIC }} - aws-region: us-east-1 - - - name: Get AWS secrets - if: ${{ steps.setup.outputs.databasePlatform == 'mysql' && steps.setup.outputs.databaseVersion == 'aws' }} - uses: aws-actions/aws-secretsmanager-get-secrets@v2 - with: - secret-ids: | - TH_MYSQLURL_8_0, /testautomation/db_details/aws_mysql_jdbc_${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} - - - name: Get AWS secrets - if: ${{ steps.setup.outputs.databasePlatform == 'mysql' && steps.setup.outputs.databaseVersion == 'aurora' }} - uses: aws-actions/aws-secretsmanager-get-secrets@v2 - with: - secret-ids: | - TH_AURORA_MYSQLURL, /testautomation/db_details/aurora_mysql_jdbc_${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} - - - - name: Get AWS secrets - if: ${{ steps.setup.outputs.databasePlatform == 'oracle' }} - uses: aws-actions/aws-secretsmanager-get-secrets@v2 - with: - secret-ids: | - TH_ORACLEURL_19, /testautomation/db_details/aws_oracle_19_jdbc_${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} - - - name: Get AWS secrets - if: ${{ steps.setup.outputs.databasePlatform == 'postgresql' && steps.setup.outputs.databaseVersion != 'aurora' }} - uses: aws-actions/aws-secretsmanager-get-secrets@v2 - with: - secret-ids: | - TH_PGRESURL_12, /testautomation/db_details/aws_postgresql_12_jdbc_${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} - TH_PGRESURL_13, /testautomation/db_details/aws_postgresql_13_jdbc_${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} - TH_PGRESURL_14, /testautomation/db_details/aws_postgresql_14_jdbc_${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} - - - name: Get AWS secrets - if: ${{ steps.setup.outputs.databasePlatform == 'mariadb' }} - uses: aws-actions/aws-secretsmanager-get-secrets@v2 - with: - secret-ids: | - TH_MARIADBURL_10_6, /testautomation/db_details/aws_mariadb_jdbc_${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} - - - name: Get AWS secrets - if: ${{ steps.setup.outputs.databasePlatform == 'mssql' }} - uses: aws-actions/aws-secretsmanager-get-secrets@v2 - with: - secret-ids: | - TH_MSSQLURL, /testautomation/db_details/aws_mssql_jdbc_${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} - - - name: Get AWS secrets - if: ${{ steps.setup.outputs.databasePlatform == 'postgresql' && steps.setup.outputs.databaseVersion == 'aurora' }} - uses: aws-actions/aws-secretsmanager-get-secrets@v2 - with: - secret-ids: | - TH_AURORA_POSTGRESQLURL, /testautomation/db_details/aurora_postgresql_jdbc_${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} - - - uses: liquibase/liquibase-github-action@v7 - if: ${{ steps.setup.outputs.databasePlatform == 'oracle' }} - with: - operation: "update" - classpath: "src/test/resources/init-changelogs/aws" - changeLogFile: "oracle.sql" - username: "${{secrets.TH_DB_ADMIN}}" - password: "${{secrets.TH_DB_PASSWD}}" - url: "${{ env.TH_ORACLEURL_19 }}" - - - uses: liquibase/liquibase-github-action@v7 - if: ${{ steps.setup.outputs.databasePlatform == 'postgresql' && steps.setup.outputs.databaseVersion != 'aurora' }} - with: - operation: "update" - classpath: "src/test/resources/init-changelogs/aws" - changeLogFile: "postgresql.sql" - username: "${{secrets.TH_DB_ADMIN}}" - password: "${{secrets.TH_DB_PASSWD}}" - url: "${{ env[format('TH_PGRESURL_{0}', steps.setup.outputs.databaseVersion)] }}" - - - uses: liquibase/liquibase-github-action@v7 - if: ${{ steps.setup.outputs.databasePlatform == 'mariadb' }} - with: - operation: "update" - classpath: "src/test/resources/init-changelogs/aws" - changeLogFile: "mariadb.sql" - username: "${{secrets.TH_DB_ADMIN}}" - password: "${{secrets.TH_DB_PASSWD}}" - url: "${{ env.TH_MARIADBURL_10_6 }}" - - - uses: liquibase/liquibase-github-action@v7 - if: ${{ steps.setup.outputs.databasePlatform == 'mssql' }} - with: - operation: "update" - classpath: "src/test/resources/init-changelogs/aws" - changeLogFile: "mssql.sql" - username: "${{secrets.TH_DB_ADMIN}}" - password: "${{secrets.TH_DB_PASSWD}}" - url: "${{ env.TH_MSSQLURL }}" - - - uses: liquibase/liquibase-github-action@v7 - if: ${{ steps.setup.outputs.databasePlatform == 'postgresql' && steps.setup.outputs.databaseVersion == 'aurora' }} - with: - operation: "update" - classpath: "src/test/resources/init-changelogs/aws" - changeLogFile: "postgresql.sql" - username: "${{secrets.TH_DB_ADMIN}}" - password: "${{secrets.TH_DB_PASSWD}}" - url: "${{ env.TH_AURORA_POSTGRESQLURL }}" - - - name: Cache local Maven repository - uses: actions/cache@v3 - with: - path: ~/.m2/repository - key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} - restore-keys: | - ${{ runner.os }}-maven- - - - name: AWS RDS ${{ steps.setup.outputs.databasePlatform }}-${{ steps.setup.outputs.databaseVersion }} Test Run - if: ${{ steps.setup.outputs.databasePlatform == 'postgresql' && steps.setup.outputs.databaseVersion != 'aurora' }} - env: - LIQUIBASE_PRO_LICENSE_KEY: ${{ secrets.LICENSE_KEY }} - run: mvn -Dtest=${{ needs.setup.outputs.testClasses }} -DconfigFile=/harness-config-cloud.yml -DdbName=${{ steps.setup.outputs.databasePlatform }} -DdbVersion=${{ steps.setup.outputs.databaseVersion }} -Dprefix=aws -DdbUsername=${{secrets.TH_DB_ADMIN}} -DdbPassword=${{secrets.TH_DB_PASSWD}} -DdbUrl='${{ env[format('TH_PGRESURL_{0}', steps.setup.outputs.databaseVersion)] }}' test - - - name: AWS RDS ${{ steps.setup.outputs.databasePlatform }}-${{ steps.setup.outputs.databaseVersion }} Test Run - if: ${{ steps.setup.outputs.databasePlatform == 'oracle' }} - env: - LIQUIBASE_PRO_LICENSE_KEY: ${{ secrets.LICENSE_KEY }} - run: mvn -Dtest=${{ needs.setup.outputs.testClasses }} -DconfigFile=/harness-config-cloud.yml -DdbName=${{ steps.setup.outputs.databasePlatform }} -DdbVersion=${{ steps.setup.outputs.databaseVersion }} -DdbUsername=${{secrets.TH_DB_ADMIN}} -DdbPassword=${{secrets.TH_DB_PASSWD}} -DdbUrl='${{ env.TH_ORACLEURL_19 }}' test - - - name: AWS RDS ${{ steps.setup.outputs.databasePlatform }}-${{ steps.setup.outputs.databaseVersion }} Test Run - if: ${{ steps.setup.outputs.databasePlatform == 'mariadb' }} - env: - LIQUIBASE_PRO_LICENSE_KEY: ${{ secrets.LICENSE_KEY }} - run: mvn -Dtest=${{ needs.setup.outputs.testClasses }} -DconfigFile=/harness-config-cloud.yml -DdbName=${{ steps.setup.outputs.databasePlatform }} -DdbVersion=${{ steps.setup.outputs.databaseVersion }} -DdbUsername=${{secrets.TH_DB_ADMIN}} -DdbPassword=${{secrets.TH_DB_PASSWD}} -DdbUrl='${{ env.TH_MARIADBURL_10_6 }}' test - - - name: AWS RDS ${{ steps.setup.outputs.databasePlatform }}-${{ steps.setup.outputs.databaseVersion }} Test Run - if: ${{ steps.setup.outputs.databasePlatform == 'mysql' && steps.setup.outputs.databaseVersion == 'aws' }} - env: - LIQUIBASE_PRO_LICENSE_KEY: ${{ secrets.LICENSE_KEY }} - run: mvn -Dtest=${{ needs.setup.outputs.testClasses }} -DconfigFile=/harness-config-cloud.yml -DdbName=${{ steps.setup.outputs.databasePlatform }} -DdbVersion=${{ steps.setup.outputs.databaseVersion }} -DdbUsername=${{secrets.TH_DB_ADMIN}} -DdbPassword=${{secrets.TH_DB_PASSWD}} -DdbUrl='${{ env.TH_MYSQLURL_8_0 }}' test - - - name: AWS RDS ${{ steps.setup.outputs.databasePlatform }}-${{ steps.setup.outputs.databaseVersion }} Test Run - if: ${{ steps.setup.outputs.databasePlatform == 'mssql' }} - env: - LIQUIBASE_PRO_LICENSE_KEY: ${{ secrets.LICENSE_KEY }} - run: mvn -Dtest=${{ needs.setup.outputs.testClasses }} -DconfigFile=/harness-config-cloud.yml -DdbName=${{ steps.setup.outputs.databasePlatform }} -DdbVersion=${{ steps.setup.outputs.databaseVersion }} -DdbUsername=${{secrets.TH_DB_ADMIN}} -DdbPassword=${{secrets.TH_DB_PASSWD}} -DdbUrl='${{ env.TH_MSSQLURL }}' test - - - name: AWS Aurora ${{ steps.setup.outputs.databasePlatform }} Test Run - if: ${{ steps.setup.outputs.databasePlatform == 'mysql' && steps.setup.outputs.databaseVersion == 'aurora' }} - env: - LIQUIBASE_PRO_LICENSE_KEY: ${{ secrets.LICENSE_KEY }} - run: mvn -Dtest=${{ needs.setup.outputs.testClasses }} -DconfigFile=/harness-config-cloud.yml -DdbName=${{ steps.setup.outputs.databasePlatform }} -DdbVersion=${{ steps.setup.outputs.databaseVersion }} -DdbUsername=${{secrets.TH_DB_ADMIN}} -DdbPassword=${{secrets.TH_DB_PASSWD}} -DdbUrl='${{ env.TH_AURORA_MYSQLURL }}' test - - - name: AWS Aurora ${{ steps.setup.outputs.databasePlatform }} Test Run - if: ${{ steps.setup.outputs.databasePlatform == 'postgresql' && steps.setup.outputs.databaseVersion == 'aurora' }} - env: - LIQUIBASE_PRO_LICENSE_KEY: ${{ secrets.LICENSE_KEY }} - run: mvn -Dtest=${{ needs.setup.outputs.testClasses }} -DconfigFile=/harness-config-cloud.yml -DdbName=${{ steps.setup.outputs.databasePlatform }} -DdbVersion=13 -Dprefix=aurora -DdbUsername=${{secrets.TH_DB_ADMIN}} -DdbPassword=${{secrets.TH_DB_PASSWD}} -DdbUrl='${{ env.TH_AURORA_POSTGRESQLURL }}' test - - - name: Archive AWS RDS ${{ steps.setup.outputs.databasePlatform }}-${{ steps.setup.outputs.databaseVersion }} Test Results - uses: actions/upload-artifact@v4 - with: - name: aws-rds-${{ steps.setup.outputs.databasePlatform }}-${{ steps.setup.outputs.databaseVersion }}-test-results - path: build/spock-reports - - destroy-ephemeral-cloud-infra: - if: always() - needs: [ deploy-ephemeral-cloud-infra, test ] - uses: liquibase/build-logic/.github/workflows/ephemeral-cloud-infra.yml@DAT-17834 - secrets: inherit - with: - destroy: true - stack_id: ${{ needs.deploy-ephemeral-cloud-infra.outputs.stack_id }} - aws_postgresql: ${{ contains(inputs.databases, 'postgresql:12') || contains(inputs.databases, 'postgresql:13') || contains(inputs.databases, 'postgresql:14')}} - aws_oracle: ${{ contains(inputs.databases, 'oracle') }} - aws_mariadb: ${{ contains(inputs.databases, 'mariadb') }} - aws_aurora_mysql: ${{ contains(inputs.databases, 'mysql:aurora') }} - aws_mssql: ${{ contains(inputs.databases, 'mssql') }} - aws_aurora_postgres: ${{ contains(inputs.databases, 'postgresql:aurora') }} - aws_mysql: ${{ contains(inputs.databases, 'mysql:aws') }} From e2dbf7a9d1e3e4e1642050500d00408a6216605d Mon Sep 17 00:00:00 2001 From: jandroav Date: Mon, 3 Jun 2024 14:54:25 +0200 Subject: [PATCH 33/37] =?UTF-8?q?=F0=9F=94=A7=20(aws-weekly.yml):=20Update?= =?UTF-8?q?=20schedule=20to=20execute=20the=20workflow=20every=20Sunday=20?= =?UTF-8?q?at=204:00=20AM=20instead=20of=206:00=20AM=20=F0=9F=94=A7=20(aws?= =?UTF-8?q?-weekly.yml):=20Update=20the=20version=20of=20the=20ephemeral-c?= =?UTF-8?q?loud-infra.yml=20workflow=20to=20DAT-17834=20=F0=9F=94=A7=20(aw?= =?UTF-8?q?s-weekly.yml):=20Add=20support=20for=20different=20database=20t?= =?UTF-8?q?ypes=20in=20the=20deploy-ephemeral-cloud-infra=20job=20?= =?UTF-8?q?=F0=9F=94=A7=20(aws-weekly.yml):=20Add=20permissions=20for=20co?= =?UTF-8?q?ntents=20read=20and=20id-token=20write=20in=20the=20init-mysql?= =?UTF-8?q?=20job=20=F0=9F=94=A7=20(aws-weekly.yml):=20Add=20configuration?= =?UTF-8?q?=20for=20different=20database=20types=20in=20the=20init-mysql?= =?UTF-8?q?=20job=20=F0=9F=94=A7=20(aws-weekly.yml):=20Add=20configuration?= =?UTF-8?q?=20for=20different=20database=20types=20in=20the=20test=20job?= =?UTF-8?q?=20=F0=9F=94=A7=20(aws-weekly.yml):=20Add=20permissions=20for?= =?UTF-8?q?=20contents=20read=20and=20id-token=20write=20in=20the=20test?= =?UTF-8?q?=20job=20=F0=9F=94=A7=20(aws-weekly.yml):=20Update=20the=20conf?= =?UTF-8?q?iguration=20to=20get=20AWS=20secrets=20based=20on=20database=20?= =?UTF-8?q?platform=20and=20version=20in=20the=20test=20job?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 🔧 (aws-weekly.yml): Update GitHub Action to install a SQL Server suite of tools and run sqlcmd for MSSQL platform 🔧 (aws-weekly.yml): Add conditional logic to destroy ephemeral cloud infrastructure based on specified databases in inputs --- .github/workflows/aws-weekly.yml | 177 ++++++++++++++++++------------- 1 file changed, 101 insertions(+), 76 deletions(-) diff --git a/.github/workflows/aws-weekly.yml b/.github/workflows/aws-weekly.yml index cf69d1af5..8e58610de 100644 --- a/.github/workflows/aws-weekly.yml +++ b/.github/workflows/aws-weekly.yml @@ -1,12 +1,11 @@ # Terraform Action to test Cloud Databases with test-harness name: AWS Weekly Cloud Database Test Execution -concurrency: aws-run on: # Triggers the workflow on a schedule for the main branch. Also allows for manual triggers - # Execute every sunday at 6:00 AM + # Execute every sunday at 4:00 AM schedule: - - cron: '0 6 * * 0' + - cron: '0 4 * * 0' workflow_dispatch: inputs: testClasses: @@ -38,15 +37,24 @@ jobs: uses: actions/checkout@v4 deploy-ephemeral-cloud-infra: - uses: liquibase/build-logic/.github/workflows/ephemeral-cloud-infra.yml@main + uses: liquibase/build-logic/.github/workflows/ephemeral-cloud-infra.yml@DAT-17834 secrets: inherit with: deploy: true - aws_test_harness: true + aws_postgresql: ${{ contains(inputs.databases, 'postgresql:12') || contains(inputs.databases, 'postgresql:13') || contains(inputs.databases, 'postgresql:14')}} + aws_oracle: ${{ contains(inputs.databases, 'oracle') }} + aws_mariadb: ${{ contains(inputs.databases, 'mariadb') }} + aws_aurora_mysql: ${{ contains(inputs.databases, 'mysql:aurora') }} + aws_mssql: ${{ contains(inputs.databases, 'mssql') }} + aws_aurora_postgres: ${{ contains(inputs.databases, 'postgresql:aurora') }} + aws_mysql: ${{ contains(inputs.databases, 'mysql:aws') }} init-mysql: runs-on: ubuntu-latest needs: [deploy-ephemeral-cloud-infra] + permissions: + contents: read + id-token: write container: image: liquibase/liquibase:latest env: @@ -69,52 +77,43 @@ jobs: role-to-assume: ${{ secrets.AWS_DEV_GITHUB_OIDC_ROLE_ARN_BUILD_LOGIC }} aws-region: us-east-1 + - name: Configure Test + id: setup + uses: actions/github-script@v7.0.1 + with: + script: | + let splitValues = "${{ matrix.database }}".split(":") + core.setOutput("databasePlatform", splitValues[0]); + core.setOutput("databaseVersion", splitValues[1]); - name: Get AWS secrets + if: ${{ matrix.version == 'aws' && matrix.database == 'mysql'}} uses: aws-actions/aws-secretsmanager-get-secrets@v2 with: secret-ids: | - TH_MYSQLURL_8_0, /testautomation/db_details/aws_mysql_jdbc${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} - TH_AURORA_MYSQLURL, /testautomation/db_details/aurora_mysql_jdbc${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} - TH_ORACLEURL_19, /testautomation/db_details/aws_oracle_19_jdbc${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} - TH_PGRESURL_12, /testautomation/db_details/aws_postgresql_12_jdbc${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} - TH_PGRESURL_13, /testautomation/db_details/aws_postgresql_13_jdbc${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} - TH_PGRESURL_14, /testautomation/db_details/aws_postgresql_14_jdbc${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} - TH_MARIADBURL_10_6, /testautomation/db_details/aws_mariadb_jdbc${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} - TH_MSSQLURL, /testautomation/db_details/aws_mssql_jdbc${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} - TH_AURORA_POSTGRESQLURL, /testautomation/db_details/aurora_postgresql_jdbc${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} - + TH_MYSQLURL_8_0, /testautomation/db_details/aws_mysql_jdbc_${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} + - name: Get AWS secrets + if: ${{ matrix.version == 'aurora' && matrix.database == 'mysql'}} + uses: aws-actions/aws-secretsmanager-get-secrets@v2 + with: + secret-ids: | + TH_AURORA_MYSQLURL, /testautomation/db_details/aurora_mysql_jdbc_${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} #This additional init step is required because of mysql driver issue on GH actions - name: Install Dependencies run: lpm update && lpm add mysql - - name: Clean AWS MySQL Database - uses: liquibase-github-actions/drop-all@v4.25.1 - if: ${{ matrix.version == 'aws' }} - with: - url: "${{ env.TH_MYSQLURL_8_0 }}" - username: "${{secrets.TH_DB_ADMIN}}" - password: "${{secrets.TH_DB_PASSWD}}" - licenseKey: "${{secrets.LICENSE_KEY}}" - - name: Init Database - if: ${{ matrix.version == 'aws' }} - run: liquibase --classpath="src/test/resources/init-changelogs/aws" --changeLogFile="${{ matrix.database }}.sql" --username="${{ secrets.TH_DB_ADMIN }}" --password="${{ secrets.TH_DB_PASSWD }}" --url="${{ env.TH_MYSQLURL_8_0 }}" update - - - name: Clean Aurora MySQL Database - uses: liquibase-github-actions/drop-all@v4.25.1 - if: ${{ matrix.version == 'aurora' }} - with: - url: "${{ env.TH_AURORA_MYSQLURL }}" - username: "${{secrets.TH_DB_ADMIN}}" - password: "${{secrets.TH_DB_PASSWD}}" - licenseKey: "${{secrets.LICENSE_KEY}}" + if: ${{ matrix.version == 'aws' && matrix.database == 'mysql'}} + run: liquibase --classpath="src/test/resources/init-changelogs/aws" --changeLogFile="${{ matrix.database }}_cloud.sql" --username="${{ secrets.TH_DB_ADMIN }}" --password="${{ secrets.TH_DB_PASSWD }}" --url="${{ env.TH_MYSQLURL_8_0 }}" update - name: Init Database - if: ${{ matrix.version == 'aurora' }} - run: liquibase --classpath="src/test/resources/init-changelogs/aws" --changeLogFile="${{ matrix.database }}.sql" --username="${{ secrets.TH_DB_ADMIN }}" --password="${{ secrets.TH_DB_PASSWD }}" --url="${{ env.TH_AURORA_MYSQLURL }}" update + if: ${{ matrix.version == 'aurora' && matrix.database == 'mysql'}} + run: liquibase --classpath="src/test/resources/init-changelogs/aws" --changeLogFile="${{ matrix.database }}_cloud.sql" --username="${{ secrets.TH_DB_ADMIN }}" --password="${{ secrets.TH_DB_PASSWD }}" --url="${{ env.TH_AURORA_MYSQLURL }}" update test: - needs: [init-mysql, setup] + needs: [deploy-ephemeral-cloud-infra, init-mysql, setup] + permissions: + contents: read + id-token: write runs-on: ubuntu-latest strategy: fail-fast: false @@ -133,15 +132,57 @@ jobs: let splitValues = "${{ matrix.database }}".split(":") core.setOutput("databasePlatform", splitValues[0]); core.setOutput("databaseVersion", splitValues[1]); + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v4 + with: + role-to-assume: ${{ secrets.AWS_DEV_GITHUB_OIDC_ROLE_ARN_BUILD_LOGIC }} + aws-region: us-east-1 - - uses: liquibase-github-actions/drop-all@v4.25.1 + - name: Get AWS secrets + if: ${{ steps.setup.outputs.databasePlatform == 'mysql' && steps.setup.outputs.databaseVersion == 'aws' }} + uses: aws-actions/aws-secretsmanager-get-secrets@v2 + with: + secret-ids: | + TH_MYSQLURL_8_0, /testautomation/db_details/aws_mysql_jdbc_${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} + - name: Get AWS secrets + if: ${{ steps.setup.outputs.databasePlatform == 'mysql' && steps.setup.outputs.databaseVersion == 'aurora' }} + uses: aws-actions/aws-secretsmanager-get-secrets@v2 + with: + secret-ids: | + TH_AURORA_MYSQLURL, /testautomation/db_details/aurora_mysql_jdbc_${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} + - name: Get AWS secrets if: ${{ steps.setup.outputs.databasePlatform == 'oracle' }} + uses: aws-actions/aws-secretsmanager-get-secrets@v2 with: - url: "${{ env.TH_ORACLEURL_19 }}" - username: "${{secrets.TH_DB_ADMIN}}" - password: "${{secrets.TH_DB_PASSWD}}" - licenseKey: "${{secrets.LICENSE_KEY}}" - + secret-ids: | + TH_ORACLEURL_19, /testautomation/db_details/aws_oracle_19_jdbc_${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} + - name: Get AWS secrets + if: ${{ steps.setup.outputs.databasePlatform == 'postgresql' && steps.setup.outputs.databaseVersion != 'aurora' }} + uses: aws-actions/aws-secretsmanager-get-secrets@v2 + with: + secret-ids: | + TH_PGRESURL_12, /testautomation/db_details/aws_postgresql_12_jdbc_${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} + TH_PGRESURL_13, /testautomation/db_details/aws_postgresql_13_jdbc_${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} + TH_PGRESURL_14, /testautomation/db_details/aws_postgresql_14_jdbc_${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} + - name: Get AWS secrets + if: ${{ steps.setup.outputs.databasePlatform == 'mariadb' }} + uses: aws-actions/aws-secretsmanager-get-secrets@v2 + with: + secret-ids: | + TH_MARIADBURL_10_6, /testautomation/db_details/aws_mariadb_jdbc_${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} + - name: Get AWS secrets + if: ${{ steps.setup.outputs.databasePlatform == 'mssql' }} + uses: aws-actions/aws-secretsmanager-get-secrets@v2 + with: + secret-ids: | + TH_MSSQLURL, /testautomation/db_details/aws_mssql_jdbc_${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} + TH_MSSQLURL_HOST, /testautomation/db_details/aws_mssql_host_${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} + - name: Get AWS secrets + if: ${{ steps.setup.outputs.databasePlatform == 'postgresql' && steps.setup.outputs.databaseVersion == 'aurora' }} + uses: aws-actions/aws-secretsmanager-get-secrets@v2 + with: + secret-ids: | + TH_AURORA_POSTGRESQLURL, /testautomation/db_details/aurora_postgresql_jdbc_${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} - uses: liquibase/liquibase-github-action@v7 if: ${{ steps.setup.outputs.databasePlatform == 'oracle' }} with: @@ -152,14 +193,6 @@ jobs: password: "${{secrets.TH_DB_PASSWD}}" url: "${{ env.TH_ORACLEURL_19 }}" - - uses: liquibase-github-actions/drop-all@v4.25.1 - if: ${{ steps.setup.outputs.databasePlatform == 'postgresql' && steps.setup.outputs.databaseVersion != 'aurora' }} - with: - url: "${{ env[format('TH_PGRESURL_{0}', steps.setup.outputs.databaseVersion)] }}" - username: "${{secrets.TH_DB_ADMIN}}" - password: "${{secrets.TH_DB_PASSWD}}" - licenseKey: "${{secrets.LICENSE_KEY}}" - - uses: liquibase/liquibase-github-action@v7 if: ${{ steps.setup.outputs.databasePlatform == 'postgresql' && steps.setup.outputs.databaseVersion != 'aurora' }} with: @@ -170,14 +203,6 @@ jobs: password: "${{secrets.TH_DB_PASSWD}}" url: "${{ env[format('TH_PGRESURL_{0}', steps.setup.outputs.databaseVersion)] }}" - - uses: liquibase-github-actions/drop-all@v4.25.1 - if: ${{ steps.setup.outputs.databasePlatform == 'mariadb' }} - with: - url: "${{ env.TH_MARIADBURL_10_6 }}" - username: "${{secrets.TH_DB_ADMIN}}" - password: "${{secrets.TH_DB_PASSWD}}" - licenseKey: "${{secrets.LICENSE_KEY}}" - - uses: liquibase/liquibase-github-action@v7 if: ${{ steps.setup.outputs.databasePlatform == 'mariadb' }} with: @@ -188,13 +213,15 @@ jobs: password: "${{secrets.TH_DB_PASSWD}}" url: "${{ env.TH_MARIADBURL_10_6 }}" - - uses: liquibase-github-actions/drop-all@v4.25.1 + - name: Install a SQL Server suite of tools if: ${{ steps.setup.outputs.databasePlatform == 'mssql' }} + uses: potatoqualitee/mssqlsuite@v1.7 with: - url: "${{ env.TH_MSSQLURL }}" - username: "${{secrets.TH_DB_ADMIN}}" - password: "${{secrets.TH_DB_PASSWD}}" - licenseKey: "${{secrets.LICENSE_KEY}}" + install: sqlengine, sqlclient, sqlpackage + + - name: Run sqlcmd + if: ${{ steps.setup.outputs.databasePlatform == 'mssql' }} + run: sqlcmd -S ${{ env.TH_MSSQLURL_HOST }} -U ${{secrets.TH_DB_ADMIN}} -P ${{secrets.TH_DB_PASSWD}} -Q "CREATE DATABASE lbcat" - uses: liquibase/liquibase-github-action@v7 if: ${{ steps.setup.outputs.databasePlatform == 'mssql' }} @@ -206,14 +233,6 @@ jobs: password: "${{secrets.TH_DB_PASSWD}}" url: "${{ env.TH_MSSQLURL }}" - - uses: liquibase-github-actions/drop-all@v4.25.1 - if: ${{ steps.setup.outputs.databasePlatform == 'postgresql' && steps.setup.outputs.databaseVersion == 'aurora' }} - with: - url: "${{ env.TH_AURORA_POSTGRESQLURL }}" - username: "${{secrets.TH_DB_ADMIN}}" - password: "${{secrets.TH_DB_PASSWD}}" - licenseKey: "${{secrets.LICENSE_KEY}}" - - uses: liquibase/liquibase-github-action@v7 if: ${{ steps.setup.outputs.databasePlatform == 'postgresql' && steps.setup.outputs.databaseVersion == 'aurora' }} with: @@ -231,7 +250,6 @@ jobs: key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} restore-keys: | ${{ runner.os }}-maven- - - name: AWS RDS ${{ steps.setup.outputs.databasePlatform }}-${{ steps.setup.outputs.databaseVersion }} Test Run if: ${{ steps.setup.outputs.databasePlatform == 'postgresql' && steps.setup.outputs.databaseVersion != 'aurora' }} env: @@ -283,9 +301,16 @@ jobs: destroy-ephemeral-cloud-infra: if: always() needs: [ deploy-ephemeral-cloud-infra, test ] - uses: liquibase/build-logic/.github/workflows/ephemeral-cloud-infra.yml@main + uses: liquibase/build-logic/.github/workflows/ephemeral-cloud-infra.yml@DAT-17834 secrets: inherit with: destroy: true stack_id: ${{ needs.deploy-ephemeral-cloud-infra.outputs.stack_id }} - aws_test_harness: true \ No newline at end of file + aws_postgresql: ${{ contains(inputs.databases, 'postgresql:12') || contains(inputs.databases, 'postgresql:13') || contains(inputs.databases, 'postgresql:14')}} + aws_oracle: ${{ contains(inputs.databases, 'oracle') }} + aws_mariadb: ${{ contains(inputs.databases, 'mariadb') }} + aws_aurora_mysql: ${{ contains(inputs.databases, 'mysql:aurora') }} + aws_mssql: ${{ contains(inputs.databases, 'mssql') }} + aws_aurora_postgres: ${{ contains(inputs.databases, 'postgresql:aurora') }} + aws_mysql: ${{ contains(inputs.databases, 'mysql:aws') }} + \ No newline at end of file From 78ff609af13a3bacbe6b62639cd9a6c0b38f0e62 Mon Sep 17 00:00:00 2001 From: jandroav Date: Mon, 3 Jun 2024 14:54:55 +0200 Subject: [PATCH 34/37] =?UTF-8?q?=F0=9F=94=A7=20(aws-weekly.yml):=20Update?= =?UTF-8?q?=20workflow=20to=20use=20the=20main=20branch=20for=20ephemeral-?= =?UTF-8?q?cloud-infra.yml=20instead=20of=20DAT-17834=20branch.=20Remove?= =?UTF-8?q?=20trailing=20whitespace.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/aws-weekly.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/aws-weekly.yml b/.github/workflows/aws-weekly.yml index 8e58610de..b0d92ac8e 100644 --- a/.github/workflows/aws-weekly.yml +++ b/.github/workflows/aws-weekly.yml @@ -37,7 +37,7 @@ jobs: uses: actions/checkout@v4 deploy-ephemeral-cloud-infra: - uses: liquibase/build-logic/.github/workflows/ephemeral-cloud-infra.yml@DAT-17834 + uses: liquibase/build-logic/.github/workflows/ephemeral-cloud-infra.yml@main secrets: inherit with: deploy: true @@ -301,7 +301,7 @@ jobs: destroy-ephemeral-cloud-infra: if: always() needs: [ deploy-ephemeral-cloud-infra, test ] - uses: liquibase/build-logic/.github/workflows/ephemeral-cloud-infra.yml@DAT-17834 + uses: liquibase/build-logic/.github/workflows/ephemeral-cloud-infra.yml@main secrets: inherit with: destroy: true @@ -313,4 +313,3 @@ jobs: aws_mssql: ${{ contains(inputs.databases, 'mssql') }} aws_aurora_postgres: ${{ contains(inputs.databases, 'postgresql:aurora') }} aws_mysql: ${{ contains(inputs.databases, 'mysql:aws') }} - \ No newline at end of file From 1a420dbd0334d4810c0dc9045d7f7866a06bb2d8 Mon Sep 17 00:00:00 2001 From: jandroav Date: Tue, 4 Jun 2024 13:01:56 +0200 Subject: [PATCH 35/37] =?UTF-8?q?=F0=9F=94=A7=20(aws-weekly.yml):=20Add=20?= =?UTF-8?q?missing=20newline=20characters=20for=20better=20readability=20a?= =?UTF-8?q?nd=20maintainability.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/aws-weekly.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/aws-weekly.yml b/.github/workflows/aws-weekly.yml index b0d92ac8e..4725cd976 100644 --- a/.github/workflows/aws-weekly.yml +++ b/.github/workflows/aws-weekly.yml @@ -85,6 +85,7 @@ jobs: let splitValues = "${{ matrix.database }}".split(":") core.setOutput("databasePlatform", splitValues[0]); core.setOutput("databaseVersion", splitValues[1]); + - name: Get AWS secrets if: ${{ matrix.version == 'aws' && matrix.database == 'mysql'}} uses: aws-actions/aws-secretsmanager-get-secrets@v2 @@ -132,6 +133,7 @@ jobs: let splitValues = "${{ matrix.database }}".split(":") core.setOutput("databasePlatform", splitValues[0]); core.setOutput("databaseVersion", splitValues[1]); + - name: Configure AWS Credentials uses: aws-actions/configure-aws-credentials@v4 with: @@ -144,18 +146,21 @@ jobs: with: secret-ids: | TH_MYSQLURL_8_0, /testautomation/db_details/aws_mysql_jdbc_${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} + - name: Get AWS secrets if: ${{ steps.setup.outputs.databasePlatform == 'mysql' && steps.setup.outputs.databaseVersion == 'aurora' }} uses: aws-actions/aws-secretsmanager-get-secrets@v2 with: secret-ids: | TH_AURORA_MYSQLURL, /testautomation/db_details/aurora_mysql_jdbc_${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} + - name: Get AWS secrets if: ${{ steps.setup.outputs.databasePlatform == 'oracle' }} uses: aws-actions/aws-secretsmanager-get-secrets@v2 with: secret-ids: | TH_ORACLEURL_19, /testautomation/db_details/aws_oracle_19_jdbc_${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} + - name: Get AWS secrets if: ${{ steps.setup.outputs.databasePlatform == 'postgresql' && steps.setup.outputs.databaseVersion != 'aurora' }} uses: aws-actions/aws-secretsmanager-get-secrets@v2 @@ -164,12 +169,14 @@ jobs: TH_PGRESURL_12, /testautomation/db_details/aws_postgresql_12_jdbc_${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} TH_PGRESURL_13, /testautomation/db_details/aws_postgresql_13_jdbc_${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} TH_PGRESURL_14, /testautomation/db_details/aws_postgresql_14_jdbc_${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} + - name: Get AWS secrets if: ${{ steps.setup.outputs.databasePlatform == 'mariadb' }} uses: aws-actions/aws-secretsmanager-get-secrets@v2 with: secret-ids: | TH_MARIADBURL_10_6, /testautomation/db_details/aws_mariadb_jdbc_${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} + - name: Get AWS secrets if: ${{ steps.setup.outputs.databasePlatform == 'mssql' }} uses: aws-actions/aws-secretsmanager-get-secrets@v2 @@ -177,12 +184,14 @@ jobs: secret-ids: | TH_MSSQLURL, /testautomation/db_details/aws_mssql_jdbc_${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} TH_MSSQLURL_HOST, /testautomation/db_details/aws_mssql_host_${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} + - name: Get AWS secrets if: ${{ steps.setup.outputs.databasePlatform == 'postgresql' && steps.setup.outputs.databaseVersion == 'aurora' }} uses: aws-actions/aws-secretsmanager-get-secrets@v2 with: secret-ids: | TH_AURORA_POSTGRESQLURL, /testautomation/db_details/aurora_postgresql_jdbc_${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }} + - uses: liquibase/liquibase-github-action@v7 if: ${{ steps.setup.outputs.databasePlatform == 'oracle' }} with: @@ -250,6 +259,7 @@ jobs: key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} restore-keys: | ${{ runner.os }}-maven- + - name: AWS RDS ${{ steps.setup.outputs.databasePlatform }}-${{ steps.setup.outputs.databaseVersion }} Test Run if: ${{ steps.setup.outputs.databasePlatform == 'postgresql' && steps.setup.outputs.databaseVersion != 'aurora' }} env: From 781f3e83b87ef59ba2a03f1e42464354f2a4d0a2 Mon Sep 17 00:00:00 2001 From: Pavlo Tytarchuk Date: Tue, 4 Jun 2024 14:08:17 +0200 Subject: [PATCH 36/37] DAT-17834. fix for postgresql aurora failures. --- src/test/resources/harness-config-cloud.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/resources/harness-config-cloud.yml b/src/test/resources/harness-config-cloud.yml index c4fea4456..d7b0735b3 100644 --- a/src/test/resources/harness-config-cloud.yml +++ b/src/test/resources/harness-config-cloud.yml @@ -74,7 +74,7 @@ databasesUnderTest: - name: postgresql prefix: aurora - version: 16 + version: 13 url: DBENDPOINT username: USERNAME password: PASSWORD From d0179e2e1aa51002b67e6faf002321fcb5af61f9 Mon Sep 17 00:00:00 2001 From: Pavlo Tytarchuk Date: Tue, 4 Jun 2024 14:17:48 +0200 Subject: [PATCH 37/37] DAT-17834. fix for postgresql aurora failures. --- src/test/resources/harness-config-cloud.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/test/resources/harness-config-cloud.yml b/src/test/resources/harness-config-cloud.yml index d7b0735b3..25eab45b5 100644 --- a/src/test/resources/harness-config-cloud.yml +++ b/src/test/resources/harness-config-cloud.yml @@ -79,6 +79,13 @@ databasesUnderTest: username: USERNAME password: PASSWORD + - name: postgresql + prefix: aurora + version: 16 + url: DBENDPOINT + username: USERNAME + password: PASSWORD + - name: postgresql prefix: azure version: azure