Coder Social home page Coder Social logo

liquibase-github-action's Introduction

Deprecated

This repository is being replaced with Liquibase Github Actions which includes full command and parameter coverage. This repository will not receive any future updates. Please update your workflows. Any issues should be reported to the Liquibase GitHub Action Generator repository.

Usage

Basic Update

steps:
  - uses: actions/checkout@v2
  - uses: liquibase/liquibase-github-action@v7
    with:
      operation: 'update'
      classpath: 'example/changelogs'
      changeLogFile: 'samplechangelog.h2.sql'
      username: ${{ secrets.USERNAME }}
      password: ${{ secrets.PASSWORD }}
      url: ${{ secrets.URL }}

Optional Parameter Example:

steps:
  - uses: actions/checkout@v2
  - uses: liquibase/liquibase-github-action@v7
    with:
      operation: 'updateCount'
      classpath: 'example/changelogs'
      changeLogFile: 'samplechangelog.h2.sql'
      username: ${{ secrets.USERNAME }}
      password: ${{ secrets.PASSWORD }}
      url: ${{ secrets.URL }}
      count: 2

Required Inputs

operation is required for every use.

The operation input expects one of the following:

  • update
  • updateCount
  • tag
  • updateToTag
  • updateTestingRollback
  • rollback
  • rollbackCount
  • rollbackToDate
  • updateSQL
  • futureRollbackSQL
  • status
  • history
  • diff
  • validate
  • 'checks run' (note that the checks run command must be wrapped with quotes in your build.yml because the command has a space in it)

Optional Inputs

username, password, url, classpath, changeLogFile, count, tag, date, referenceUrl, proLicenseKey (deprecated in favor of licenseKey) and hubApiKey are optional inputs that may be required by some operations.

It is recommended that licenseKey and hubApiKey are not stored in plaintext, but rather using a GitHub secret:

          licenseKey: ${{ secrets.PRO_LICENSE_KEY }}

The following operations have the subsequent required inputs:

updateCount

  • username
  • password
  • url
  • classpath
  • changeLogFile
  • count
  • databaseChangeLogTableName (optional)
  • databaseChangeLogLockTableName (optional)

tag

  • username
  • password
  • url
  • tag
  • databaseChangeLogTableName (optional)
  • databaseChangeLogLockTableName (optional)

updateToTag

  • username
  • password
  • url
  • classpath
  • changeLogFile
  • tag
  • databaseChangeLogTableName (optional)
  • databaseChangeLogLockTableName (optional)

update-testing-rollback

  • username
  • password
  • url
  • classpath
  • changeLogFile

rollback

  • username
  • password
  • url
  • classpath
  • changeLogFile
  • tag
  • databaseChangeLogTableName (optional)
  • databaseChangeLogLockTableName (optional)

rollbackCount

  • username
  • password
  • url
  • classpath
  • changeLogFile
  • count
  • databaseChangeLogTableName (optional)
  • databaseChangeLogLockTableName (optional)

rollbackToDate

  • username
  • password
  • url
  • classpath
  • changeLogFile
  • date
  • databaseChangeLogTableName (optional)
  • databaseChangeLogLockTableName (optional)

updateSQL

  • username
  • password
  • url
  • changeLogFile
  • databaseChangeLogTableName (optional)
  • databaseChangeLogLockTableName (optional)

futureRollbackSQL

  • username
  • password
  • url
  • classpath
  • changeLogFile
  • databaseChangeLogTableName (optional)
  • databaseChangeLogLockTableName (optional)

status

  • username
  • password
  • url
  • classpath
  • changeLogFile
  • databaseChangeLogTableName (optional)
  • databaseChangeLogLockTableName (optional)

diff

  • username
  • password
  • url
  • referenceUrl
  • databaseChangeLogTableName (optional)
  • databaseChangeLogLockTableName (optional)

validate

  • username
  • password
  • url
  • changeLogFile

checks run

  • changeLogFile
  • checksSettingsFile

Secrets

It is a good practice to protect your database credentials with Github Secrets

Want to help?

Want to file a bug, contribute some code, or improve documentation? Excellent! Read up on our guidelines for contributing!

Developer instructions

We've found that the easiest way to test changes to this GitHub action is to:

  • fork this repo to your personal account

  • create a sample build.yml to trigger the action, noting that the uses line specifies the relative path, which will run the action as specified in your fork (rather than the action that is published by Liquibase)

    name: Build and Test
    
    on: [push, pull_request]
    
    jobs:
      runchecks:
        name: "Run Liquibase Quality Checks"
        runs-on: ubuntu-latest
        steps:
          - uses: actions/checkout@v2
          - uses: ./
            with:
              operation: 'checks run'
              changeLogFile: 'mychangelog.sql'
              checksSettingsFile: 'liquibasech.conf'
              proLicenseKey: ${{ secrets.PRO_LICENSE_KEY }}
  • make changes as desired and observe the execution in GitHub

liquibase-github-action's People

Contributors

ap-liquibase avatar awhitford-cip avatar bryantbiggs avatar dependabot[bot] avatar gopisaba avatar jnewton03 avatar mcred avatar molivasdat avatar r2-lf avatar stevenmassaro avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

liquibase-github-action's Issues

Does not work with JDK 11

Steps to reproduce:

  • Add the following step to your pipeline before calling the liquibase action
       - name: Setup Java 11
        uses: actions/setup-java@v1
        with:
          java-version: '11'

Result:
/liquibase/liquibase: line 77: /opt/hostedtoolcache/jdk/11.0.9/x64/bin/java: No such file or directory

Applying for GitHub publisher verification for Liquibase GitHub Action

I’m writing regarding the GH Action Liquibase Github Action

Our project is starting to migrate the CI/CD to GH Actions and we are interested to use your Actions.
Providing some context, our Security team requires the "Creator Verified by GitHub" badge to start the internal GHA verification process, due to this we are blocked to use unverified Actions.

We would be grateful if you could start the GH Action verification process, as it would help us greatly.

I believe it must improve your impact in the whole GitHub community as a partner organization and also, you are letting us use your actions.

You can find more helpful information in the following articles from GitHub Docs as a good starting point on the process.

Applying for publisher verification for your organization
About marketplace badges

Add stdout to step outputs

Specifically using the updateSQL operation, there is no way to use the generated SQL in another step.

Add stdout to the step output for later use.

i.e. ${{steps.liquibase_update_sql.outputs.stdout}}

rolllback or updateTestingRollback does not seem to work

I noticed that recently some bad rollbacks were sneaking into our code base and passing our CI tests that use Liquibase.
In a nutshell, we test Liquibase scripts by applying changes, rolling back those changes, then applying them again. If that succeeds, chances are that people have valid rollbacks defined.

Alas, here is a simple example that is now passing:

-- liquibase formatted sql

-- changeset awhitford:create-simple-table
create table AW_SIMPLE (
  SIMPLE_ID int not null comment 'Simple Identifier',
  SIMPLE_DATE date not null comment 'Simple Date'
)
-- rollback drop table AW_DOES_NOT_EXIST_SHOULD_FAIL

I can see that the changeset is being applied, but I do not see any evidence that it is being rolled back and reapplied.

I have tried using two approaches:

  1. Manual 4-step operations
    1. Tag Database
    2. Update
    3. Rollback (to Tag)
    4. Update
  2. New updateTestingRollback operation (which does the same thing but in one operation)

I feel like this may have been broken for a few months now, but I can't be certain. In the 4 step approach, my observation is that it appears that the first two steps work, but the rollback does nothing, and then the subsequent update does nothing.

⚠️ It appears that I am not the only one suffering from this:

Passing runtime parameters?

Is there a way to pass runtime parameters to this github action?

Currently I have a github action that writes to an ephemeral liquibase.properties file with per-job parameters. This requires an additional job step before the liquibase action is called:

      - name: Prepare liquibase.properties file
        run: |
          touch liquibase.properties
          echo parameter.etl_user_name=${{ secrets.ETL_USER_NAME }} > liquibase.properties
          echo parameter.etl_user_password=${{ secrets.ETL_USER_PASSWORD }} > liquibase.properties

Is there a way to just pass these parameters as runtime parameters instead?

I would love to be able to use -Detl_user_name=${{ secrets.ETL_USER_NAME }} -Detl_user_password=${{ secrets.ETL_USER_PASSWORD }} instead of writing to a file in an extra step.

hubApiKey not working

I added hubApiKey: ${{ secrets.hubApiKey }} to my YAML file as follows and I get the following error, is this functionality not working?

Unexpected input(s) 'hubApiKey', valid inputs are ['entryPoint', 'args', 'operation', 'classpath', 'changeLogFile', 'username', 'password', 'url', 'count', 'tag', 'date', 'referenceUrl']


steps:
      - uses: actions/checkout@v2
      - run: wget https://download.oracle.com/otn-pub/otn_software/jdbc/216-OAuth2/ojdbc11.jar -O ojdbc11.jar
      - uses: liquibase/liquibase-github-action@v2
        with:
          operation: 'update' 
          classpath: '/github/workspace/ojdbc11.jar'
          changeLogFile: '/environment/cfg/changelog.oracle.sql'
          username: ${{ secrets.USERNAME }}
          password: ${{ secrets.PASSWORD }}
          url: ${{ secrets.URL }}
          hubApiKey: ${{ secrets.hubApiKey }}

Allow using the action with a proxy, that points to localhost

Hi,

I tried using the action in combination with the cloud sql proxy from GCP to connect to a Cloud SQL instance. The proxy opens a connection to localhost:5432 on the github runnner. I verified, that this works by using psql and a simple query. Unfortunatly, I cannot get the liquibase action to work as it fails to connect. I tried using host.docker.internal to no avail. When I ran the liquibase docker image locally. Worked.

Do you have an idea, how to fix this?

Request: Verbose flag

It would be helpful to be able to toggle the verbose flag when running compatible actions (i.e. validate) for debugging and testing purposes.

Missing support for context parameter

Hi,

currently the github action does not support contexts parameter. In order to prepare prod or qa databases this feature can be useful. Implementation is done in the following pull request.

#46

Kind regards
Andreas

spanner driver support

Hi trying to use liquibase GH actions to make database changes against spanner database.
when i'm calling gh with the below details ,
Im getting

Unexpected error running Liquibase: Driver class was not specified and could not be determined from the url (jdbc:cloudspanner:/projects/XXXXXXX

Does this work with mySQL?

I need to use this with mysql, but it doesn't work on my local install without download the mysql connector. is it possible with this action?

futureRollbackSQL shows Unexpected argument(s): ***

I'm trying to run a futureRollbackSQL but seems to be that is not working. I'm ataching my yml file and a pic with the output.
The error shows: Unexpected argument(s): ***

`
name: LiquibaseFutureRollbackSQL
on: workflow_dispatch

jobs:
update-database:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: liquibase/liquibase-github-action@v3
with:
operation: 'futureRollbackSQL'
classpath: 'db-migrations'
changeLogFile: 'changelog-db.mssql.sql'
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}
url: ${{ secrets.URL }}
`
image

Need tagExists --tag <tag string> command

Hi,
I am creating a pipeline for rollback with on dispatch_workflow where the tag is passed as an input. Before running liquibase rollback operation I want to run tagExists operation so that we can catch error as early as possible. Thank you.

How to use flag?

I am trying to use --log-level flag. Is there a way we can set that up?

Support for liquibaseSchemaName

We have our liquibase changelog in a custom schema and specify this schema in a liquibase.properties file.
Is it possible to either use the config in the properties file or to set the schema in the action to make it accessible for the action?

Thanks

Support for Labels

I use labels on my changesets to build for different environments, a command including labels might look something like:
liquibase --changeLogFile changelog.json --labels v1 update.

I wasn't able to find documentation for providing labels to the github action, just wondering if it exists but is not documented, or if it could be included as a feature?

Thank you for this github action, very appreciative that it exists at all!

Add support for hub.liquibase.com arguments

To send hub data for update/rollback/etc. operations ran through the github action, we need the following parameters added:

  • hubConnectionId
  • hubApiKey

Usually the hubApiKey should be passed as a secret, but the action needs a parameter for it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.