# Liquibase Update Error in GitHub Workflow

**URL:** <https://forum.liquibase.org/t/liquibase-update-error-in-github-workflow/9587>\
**Category:** Liquibase Development\
**Created:** [August 2, 2024, 1:47pm UTC](https://forum.liquibase.org/t/liquibase-update-error-in-github-workflow/9587 "2024-08-02T13:47:07Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rcfountain01](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.liquibase.org/rcfountain01/32/1240_2.png) [@rcfountain01](https://forum.liquibase.org/u/rcfountain01)\
**Post date:** [August 2, 2024, 1:47pm UTC](https://forum.liquibase.org/t/liquibase-update-error-in-github-workflow/9587/1 "2024-08-02T13:47:07Z")

</div>

Hi everyone! I’m attempting to set up a series of GitHub actions for version control in BigQuery schemas using Liquibase. My liquibase.properties file is as follows:

```auto
# Database connection details
url=jdbc:bigquery://https://www.googleapis.com/bigquery/v2:publicdata;ProjectId=my-dev
username=your-username
password=your-password

# BigQuery-specific properties
driver=com.simba.googlebigquery.jdbc.Driver

# Location of the private key JSON file
# Ensure this file is securely managed and not exposed in the repository.
# In a real setup, you would use a GitHub Actions secret for the key file
keyFilePath=/tmp/bigquery-key.json

# Change Log File
changeLogFile=db/changelog/db.changelog-master.sql

# Optional: Default schema for Liquibase (not typically used with BigQuery, but included for completeness)
defaultSchemaName=your-schema

# Optional: Database change log table names (optional, defaults are 'DATABASECHANGELOG' and 'DATABASECHANGELOGLOCK')
databaseChangeLogTableName=DATABASECHANGELOG
databaseChangeLogLockTableName=DATABASECHANGELOGLOCK

```

FYI, I’m including username and pw settings in the properties file only because I thought they were needed. However, I authenticate using a private key instead.

And my workflow file is below:

```auto
name: Liquibase BigQuery

on:
  push:
    branches:
      - deploy-to-bq-dev

jobs:
  liquibase:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout code
        uses: actions/checkout@v3

      - name: Set up Java
        uses: actions/setup-java@v3
        with:
          java-version: '21'
          distribution: 'corretto'

      - name: Verify Java Installation
        run: |
          echo "JAVA_HOME is $JAVA_HOME"
          ls -ld $JAVA_HOME
          ls -l $JAVA_HOME/bin
          java -version

      - name: Export JAVA_HOME
        run: |
          echo "JAVA_HOME=/opt/hostedtoolcache/Java_Corretto_jdk/21.0.4-7.1/x64" >> $GITHUB_ENV
          echo "JAVA_HOME is $JAVA_HOME"

      - name: Liquibase Update Action
        env:
          JAVA_HOME: ${{ env.JAVA_HOME }}
        uses: liquibase-github-actions/update@v4.29.0
        with:
          changelogFile: "db/changelog/db.changelog-master.sql"
          url: "jdbc:bigquery://https://www.googleapis.com/bigquery/v2:publicdata;ProjectId=my-dev"

```

The error occurs only in the last step (“Liquibase Update Action”). It reads: “ERROR: The JAVA\_HOME environment variable is not defined correctly, so Liquibase cannot be started. JAVA\_HOME is set to “/opt/hostedtoolcache/Java\_Corretto\_jdk/21.0.4-7.1/x64” and it does not exist.”

Naturally, my changelog failed to execute as a result.

I added the steps “Verify Java Installation” and “Export JAVA\_HOME” in an attempt to verify that JAVA\_HOME was indeed getting set properly. And the variable does display successfully.

But I admit I’m a GitHub and Liquibase newbie and could use some help. Any thoughts about how to correct this error?

---

<div class="post-metadata">

**Author:** ![admah](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.liquibase.org/admah/32/1238_2.png) [@admah](https://forum.liquibase.org/u/admah)\
**Post date:** [August 6, 2024, 3:38pm UTC](https://forum.liquibase.org/t/liquibase-update-error-in-github-workflow/9587/2 "2024-08-06T15:38:16Z")

</div>

@rcfountain01 have you tried using the GH Actions without the java piece? I have an [example here](https://github.com/lbadam/liquibase-github-action-example/blob/main/.github/workflows/example.yml) that just does `update`.

---

<div class="post-metadata">

**Author:** ![rcfountain01](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.liquibase.org/rcfountain01/32/1240_2.png) [@rcfountain01](https://forum.liquibase.org/u/rcfountain01)\
**Post date:** [August 6, 2024, 7:53pm UTC](https://forum.liquibase.org/t/liquibase-update-error-in-github-workflow/9587/3 "2024-08-06T19:53:32Z")

</div>

That actually wouldn’t be viable in this case. I have to use a private key json file provided to me.

---

<div class="post-metadata">

**Author:** ![rcfountain01](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.liquibase.org/rcfountain01/32/1240_2.png) [@rcfountain01](https://forum.liquibase.org/u/rcfountain01)\
**Post date:** [August 23, 2024, 3:39pm UTC](https://forum.liquibase.org/t/liquibase-update-error-in-github-workflow/9587/4 "2024-08-23T15:39:03Z")

</div>

I’ve redesigned my workflow to the following:

```auto
name: Liquibase Update

on:
  push:
    branches:
      - deploy-to-bq-dev

jobs:
  test-liquibase-action:
    runs-on: ubuntu-latest
    name: Test Liquibase Update
    steps:

      - name: Create Private Key File
        env:
          GCP_PRIVATE_KEY: ${{ secrets.LB_BQ_DEV_PRIVATE_KEY }}
        run: |
          pwd
          mkdir tmp
          echo "$GCP_PRIVATE_KEY" > /home/runner/work/BigQuery-Schema-Test/BigQuery-Schema-Test/tmp/privatekey.json
          echo "test contents"
          cd tmp
          realpath privatekey.json
      
      - uses: actions/checkout@v3
      - uses: liquibase-github-actions/update@v4.29.1
        with:
          changelogFile: 'db/changelog/db.changelog-master.sql'
          url: 'jdbc:bigquery://https://googleapis.com/bigquery/v2:443;ProjectId=dev;OAuthType=0;OAuthServiceAcctEmail=my_acct@dev.iam.gserviceaccount.com;OAuthPvtKeyPath=/home/runner/work/BigQuery-Schema-Test/BigQuery-Schema-Test/tmp/privatekey.json'
          driver: 'com.simba.googlebigquery.jdbc.Driver'

```

I am now receiving the error:

```auto
Unexpected error running Liquibase: Connection could not be created to jdbc:bigquery://https://googleapis.com/bigquery/v2:443;ProjectId=dev;OAuthType=0;OAuthServiceAcctEmail=my_account@dev.iam.gserviceaccount.com;OAuthPvtKeyPath=/home/runner/work/BigQuery-Schema-Test/BigQuery-Schema-Test/tmp/privatekey.json with driver com.simba.googlebigquery.jdbc.Driver. [Simba][BigQueryJDBCDriver](100004) HttpTransport IO error : /home/runner/work/BigQuery-Schema-Test/BigQuery-Schema-Test/tmp/privatekey.json.

```

Please note that I added the last 3 lines of the “Create Private Key File” step for debugging purposes, i.e. to verify that the private key did indeed exist where I thought it would. And I was able to verify its location. So I’m not sure why this error is occurring.
