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:
# 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:
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?