# Running Liquibase in Travis CI

**URL:** <https://forum.liquibase.org/t/running-liquibase-in-travis-ci/6101>\
**Category:** Community Content and Articles\
**Created:** [October 27, 2021, 4:29pm UTC](https://forum.liquibase.org/t/running-liquibase-in-travis-ci/6101 "2021-10-27T16:29:50Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex020/uploads/liquibase1/original/2X/8/81af1ada55fb9198255cebbe394fd74740dc1429.png) [@system](https://forum.liquibase.org/u/system)\
**Post date:** [October 27, 2021, 4:29pm UTC](https://forum.liquibase.org/t/running-liquibase-in-travis-ci/6101/1 "2021-10-27T16:29:50Z")

</div>

Originally published at: [Running Liquibase in Travis CI | Liquibase.com Blog](https://www.liquibase.com/blog/running-liquibase-in-travis-ci)

We’re always looking for ways to give back to the Liquibase Community. We’re also big on experimenting and having fun. Combining all of that in an internal Liquibase Hackathon, my team built an example showing how to use the [Liquibase Docker container](https://hub.docker.com/r/liquibase/liquibase) to execute Liquibase commands during a [Travis CI](https://travis-ci.org/) build.

## Using Liquibase with Travis CI

Using Liquibase in your Travis CI builds is as easy as editing a file. The `travis.yml` file is required for Travis CI to run your pipeline. General configuration properties are **language** and **os**. To pull the Liquibase Docker container, include **services:docker**. This is used in the **before\_install** step to set up the container. Although global environment variables are optional, the **env:global** configuration is a great place to list database JDBC URL and database credentials.

Make sure you don’t pass your credentials in plain text; GitHub secrets are one way to obfuscate sensitive data. The real magic happens in the **script** step. This is where you pass the command line to execute as Travis CI builds.&nbsp;

This is what a **script** value looks like:

```
docker run --rm -v $(pwd):$(pwd) liquibase/liquibase:4.1 --classpath=$(pwd)/changelogs --url=$URL --changeLogFile=$CHANGELOGFILE --username=$USERNAME --password=$PASSWORD $OPERATION
```

The `$CHANGELOGFILE`, `$USERNAME`, `$PASSWORD` and `$OPERATION` are read from the **env:global** configuration. Note that the example uses clear text for credentials, so don’t try this at home!&nbsp;

### Using the example repo

Want to see this work? We have created [an example repository just for you](https://github.com/liquibase/liquibase-travisci-example)! The only prerequisite is working knowledge of Git. Here’s how to use it:

1. Fork and clone the `liquibase-travisci-example` repository into a GitHub repository you own.
2. Create a new Git branch for your changes.
3. Add a new _changeset_ to `example/changelogs/samplechangelog.h2.sql`. For example:

```
--changeset your.name:4
--rollback DROP TABLE yourname;
CREATE TABLE yourname (
    id int primary key,
    name varchar(50) not null,
)
```

1. Add, commit, and push your changes to your GitHub repository.
2. See your commit trigger a build in Travis CI and execute a Liquibase update!

**_Team CICD Plugins_** _was led by Jake Newton and combined the mental might of Nathan Voxland, Derek Smart, Robert Reeves, Mike Olivas, Adeel Malik, Mike Runco, Dan Zentgraf, and Erzsebet Carmean._
