From 82fe804f69113186283a6509f6851c410b79a8a1 Mon Sep 17 00:00:00 2001 From: Abhijeet Date: Tue, 24 Sep 2024 17:05:13 +0530 Subject: [PATCH 1/3] chore: Add logs for default DB url for CI test workflows --- .github/workflows/ci-test-custom-script.yml | 12 ++++++++++++ .github/workflows/server-build.yml | 3 +++ 2 files changed, 15 insertions(+) diff --git a/.github/workflows/ci-test-custom-script.yml b/.github/workflows/ci-test-custom-script.yml index ef8aea989ea0..a98a86245369 100644 --- a/.github/workflows/ci-test-custom-script.yml +++ b/.github/workflows/ci-test-custom-script.yml @@ -197,6 +197,18 @@ jobs: uses: actions/setup-node@v4 with: node-version-file: app/client/package.json + + - name: Check DB URL + if: steps.run_result.outputs.run_result != 'success' + run: | + db_url=$(grep -oP 'APPSMITH_DB_URL=\K[^ ]+' cicontainerlocal/stacks/configuration/docker.env) + if [[ $db_url == *"postgres"* ]]; then + echo "DB is Postgres" + elif [[ $db_url == *"mongo"* ]]; then + echo "DB is MongoDB" + else + echo "Unknown DB" + fi # actions/setup-node@v4 doesn’t work properly with Yarn 3 # when the project lives in a subdirectory: https://github.com/actions/setup-node/issues/488 diff --git a/.github/workflows/server-build.yml b/.github/workflows/server-build.yml index 0a74e1eb5a35..cf17da05bb5e 100644 --- a/.github/workflows/server-build.yml +++ b/.github/workflows/server-build.yml @@ -72,6 +72,9 @@ jobs: - name: Figure out the PR number run: echo ${{ inputs.pr }} + + - name: Default database URL + run: echo "Is this a PG build? ${{ inputs.is-pg-build }}" - name: Print the Github event run: echo ${{ github.event_name }} From 8ef9a63582507740564c59328d7b7f647ae4c27a Mon Sep 17 00:00:00 2001 From: Abhijeet <41686026+abhvsn@users.noreply.github.com> Date: Thu, 26 Sep 2024 16:27:24 +0530 Subject: [PATCH 2/3] Update .github/workflows/ci-test-custom-script.yml Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --- .github/workflows/ci-test-custom-script.yml | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci-test-custom-script.yml b/.github/workflows/ci-test-custom-script.yml index a98a86245369..becd0fb5ab9d 100644 --- a/.github/workflows/ci-test-custom-script.yml +++ b/.github/workflows/ci-test-custom-script.yml @@ -201,13 +201,20 @@ jobs: - name: Check DB URL if: steps.run_result.outputs.run_result != 'success' run: | - db_url=$(grep -oP 'APPSMITH_DB_URL=\K[^ ]+' cicontainerlocal/stacks/configuration/docker.env) + db_url=$(grep -oP 'APPSMITH_DB_URL=\K[^ ]+' cicontainerlocal/stacks/configuration/docker.env || echo "") + if [[ -z "$db_url" ]]; then + echo "::error::APPSMITH_DB_URL not found in the environment file" + exit 1 + fi if [[ $db_url == *"postgres"* ]]; then - echo "DB is Postgres" + echo "::set-output name=db_type::postgres" + echo "Database type: Postgres. Ensure PostgreSQL-specific configurations are in place." elif [[ $db_url == *"mongo"* ]]; then - echo "DB is MongoDB" + echo "::set-output name=db_type::mongodb" + echo "Database type: MongoDB. Verify MongoDB connection settings if issues arise." else - echo "Unknown DB" + echo "::set-output name=db_type::unknown" + echo "::warning::Unknown database type. Please verify the database configuration." fi # actions/setup-node@v4 doesn’t work properly with Yarn 3 From d2d02667cf41ce924b92440c5e3260bc7006bf37 Mon Sep 17 00:00:00 2001 From: Abhijeet Date: Thu, 26 Sep 2024 17:08:08 +0530 Subject: [PATCH 3/3] chore: Remove the output --- .github/workflows/ci-test-custom-script.yml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci-test-custom-script.yml b/.github/workflows/ci-test-custom-script.yml index becd0fb5ab9d..2062ecb29ce9 100644 --- a/.github/workflows/ci-test-custom-script.yml +++ b/.github/workflows/ci-test-custom-script.yml @@ -206,14 +206,11 @@ jobs: echo "::error::APPSMITH_DB_URL not found in the environment file" exit 1 fi - if [[ $db_url == *"postgres"* ]]; then - echo "::set-output name=db_type::postgres" + if [[ $db_url == "postgresql"* ]]; then echo "Database type: Postgres. Ensure PostgreSQL-specific configurations are in place." - elif [[ $db_url == *"mongo"* ]]; then - echo "::set-output name=db_type::mongodb" + elif [[ $db_url == "mongo"* ]]; then echo "Database type: MongoDB. Verify MongoDB connection settings if issues arise." else - echo "::set-output name=db_type::unknown" echo "::warning::Unknown database type. Please verify the database configuration." fi