diff --git a/.github/workflows/db-update-dev.yml b/.github/workflows/db-update-dev.yml index 426f51470..c0c88d9e4 100644 --- a/.github/workflows/db-update-dev.yml +++ b/.github/workflows/db-update-dev.yml @@ -1,5 +1,5 @@ # Update the Mobility Database Schema -name: Dev Database Update +name: Database Update - DEV on: push: # Update on merge on master if the changelog file has been updated branches: @@ -19,7 +19,7 @@ jobs: PROJECT_ID: ${{ vars.DEV_MOBILITY_FEEDS_PROJECT_ID }} DB_NAME: ${{ vars.DEV_POSTGRE_SQL_DB_NAME }} REGION: ${{ vars.DEV_MOBILITY_FEEDS_REGION }} - RUN_POPULATE_SCRIPT: ${{ github.event.inputs.RUN_POPULATE_SCRIPT || false }} + RUN_POPULATE_SCRIPT: ${{ github.event.inputs.RUN_POPULATE_SCRIPT || 'true' }} secrets: DB_USER_PASSWORD: ${{ secrets.DEV_POSTGRE_USER_PASSWORD }} DB_USER_NAME: ${{ secrets.DEV_POSTGRE_USER_NAME }} diff --git a/.github/workflows/db-update-prod.yml b/.github/workflows/db-update-prod.yml index 4d4c680cc..4aa1fd6e0 100644 --- a/.github/workflows/db-update-prod.yml +++ b/.github/workflows/db-update-prod.yml @@ -1,5 +1,5 @@ # Update the Mobility Database Schema -name: PROD Database Update +name: Database Update - PROD on: release: # Update on merge on master if the changelog file has been updated paths: @@ -17,7 +17,7 @@ jobs: PROJECT_ID: ${{ vars.PROD_MOBILITY_FEEDS_PROJECT_ID }} DB_NAME: ${{ vars.PROD_POSTGRE_SQL_DB_NAME }} REGION: ${{ vars.PROD_MOBILITY_FEEDS_REGION }} - RUN_POPULATE_SCRIPT: ${{ github.event.inputs.RUN_POPULATE_SCRIPT || false }} + RUN_POPULATE_SCRIPT: ${{ github.event.inputs.RUN_POPULATE_SCRIPT || 'false' }} secrets: DB_USER_PASSWORD: ${{ secrets.PROD_POSTGRE_USER_PASSWORD }} DB_USER_NAME: ${{ secrets.PROD_POSTGRE_USER_NAME }} diff --git a/.github/workflows/db-update-qa.yml b/.github/workflows/db-update-qa.yml index 0493c8fa7..05e6bdb85 100644 --- a/.github/workflows/db-update-qa.yml +++ b/.github/workflows/db-update-qa.yml @@ -1,5 +1,5 @@ # Update the Mobility Database Schema -name: QA Database Update +name: Database Update - QA on: push: # Update on merge on main branch if the changelog file has been updated branches: @@ -19,7 +19,7 @@ jobs: PROJECT_ID: ${{ vars.QA_MOBILITY_FEEDS_PROJECT_ID }} DB_NAME: ${{ vars.QA_POSTGRE_SQL_DB_NAME }} REGION: ${{ vars.QA_MOBILITY_FEEDS_REGION }} - RUN_POPULATE_SCRIPT: ${{ github.event.inputs.RUN_POPULATE_SCRIPT || true }} + RUN_POPULATE_SCRIPT: ${{ github.event.inputs.RUN_POPULATE_SCRIPT || 'true' }} secrets: DB_USER_PASSWORD: ${{ secrets.QA_POSTGRE_USER_PASSWORD }} DB_USER_NAME: ${{ secrets.QA_POSTGRE_USER_NAME }} diff --git a/.github/workflows/db-update.yml b/.github/workflows/db-update.yml index 315f51aa9..f695561a6 100644 --- a/.github/workflows/db-update.yml +++ b/.github/workflows/db-update.yml @@ -24,11 +24,12 @@ on: description: PostgreSQL Database Name required: true type: string +# TODO: remove this parameter once the populate script is no longer needed RUN_POPULATE_SCRIPT: description: Option to run the script that populates the database required: false - default: false - type: boolean + default: 'false' + type: string REGION: description: GCP region required: true @@ -67,7 +68,7 @@ jobs: url: 'jdbc:postgresql://${{ env.DB_IP }}:5432/${{ inputs.DB_NAME }}' - name: Clear content of the database - if: inputs.RUN_POPULATE_SCRIPT + if: inputs.RUN_POPULATE_SCRIPT == 'true' uses: liquibase-github-actions/update@v4.23.0 with: classpath: 'liquibase' @@ -77,7 +78,7 @@ jobs: url: 'jdbc:postgresql://${{ env.DB_IP }}:5432/${{ inputs.DB_NAME }}' - name: Setup python - if: inputs.RUN_POPULATE_SCRIPT + if: inputs.RUN_POPULATE_SCRIPT == 'true' uses: actions/setup-python@v4 with: python-version: '3.9' @@ -94,11 +95,11 @@ jobs: cat config/.env.local - name: Install requirements and generate db model - if: inputs.RUN_POPULATE_SCRIPT + if: inputs.RUN_POPULATE_SCRIPT == 'true' run: scripts/db-gen.sh - name: Download csv version of the database - if: inputs.RUN_POPULATE_SCRIPT + if: inputs.RUN_POPULATE_SCRIPT == 'true' run: wget -O sources.csv https://bit.ly/catalogs-csv - name: Validate file download @@ -109,11 +110,11 @@ jobs: run: echo "PATH=$(realpath sources.csv)" >> $GITHUB_OUTPUT - name: Populate Database - if: inputs.RUN_POPULATE_SCRIPT + if: inputs.RUN_POPULATE_SCRIPT == 'true' run: scripts/populate-db.sh ${{ steps.getpath.outputs.PATH }} > populate.log - name: Upload log file for verification - if: inputs.RUN_POPULATE_SCRIPT + if: inputs.RUN_POPULATE_SCRIPT == 'true' uses: actions/upload-artifact@v3 with: name: populate.log