Automate Database CI/CD with GitLab Pipelines
GitLab CI is an automation tool integrated into GitLab that helps streamline code testing, building, and deployment
through configurable pipelines. Using a .gitlab-ci.yml file, developers define jobs and stages that GitLab executes
automatically, enabling consistent integration and delivery workflows.
Atlas provides CI/CD components for easy integration in any project. Click here to see the full list of components in the CI/CD catalog.
Check out this guide for full examples of the versioned and declarative flows using the GitLab components.
info
To use the components in a self-hosted instance, you must mirror the component project.
migrate-push
Pushes a migration directory to the cloud.
Usage
- MySQL
- MariaDB
- PostgreSQL
- SQLite
- SQL Server
- ClickHouse
services:
- mysql:latest
variables:
MYSQL_DATABASE: dev
MYSQL_ROOT_PASSWORD: pass
stages:
- push
include:
- component: $CI_SERVER_FQDN/arigaio/atlas/migrate-push@~latest
inputs:
stage: push
branches:
- main
dir: "file://migrations"
dir-name: "my-project"
dev-url: "mysql://root:pass@mysql:3306/dev"
atlas-cloud-token: $ATLAS_CLOUD_TOKEN
services:
- mariadb:latest
variables:
MYSQL_DATABASE: dev
MYSQL_ROOT_PASSWORD: pass
stages:
- push
include:
- component: $CI_SERVER_FQDN/arigaio/atlas/migrate-push@~latest
inputs:
stage: push
branches:
- main
dir: "file://migrations"
dir-name: "my-project"
dev-url: "maria://root:pass@mariadb:3306/dev"
atlas-cloud-token: $ATLAS_CLOUD_TOKEN
services:
- postgres:latest
variables:
POSTGRES_DB: dev
POSTGRES_USER: postgres
POSTGRES_PASSWORD: pass
stages:
- push
include:
- component: $CI_SERVER_FQDN/arigaio/atlas/migrate-push@~latest
inputs:
stage: push
branches:
- main
dir: "file://migrations"
dir-name: "my-project"
dev-url: "postgres://postgres:pass@postgres/dev?sslmode=disable"
atlas-cloud-token: $ATLAS_CLOUD_TOKEN
stages:
- push
include:
- component: $CI_SERVER_FQDN/arigaio/atlas/migrate-push@~latest
inputs:
branches:
- main
stage: push
dir: "file://migrations"
dir-name: "my-project"
dev-url: "sqlite://db?mode-memory"
atlas-cloud-token: $ATLAS_CLOUD_TOKEN
services:
- name: mcr.microsoft.com/mssql/server:2022-latest
alias: sqlserver
variables:
ACCEPT_EULA: Y
MSSQL_PID: Developer
MSSQL_SA_PASSWORD: P@ssw0rd0995
stages:
- push
include:
- component: $CI_SERVER_FQDN/arigaio/atlas/migrate-push@~latest
inputs:
branches:
- main
stage: push
dir: "file://migrations"
dir-name: "my-project"
dev-url: sqlserver://sa:P@ssw0rd0995@localhost:1433?database=master
atlas-cloud-token: $ATLAS_CLOUD_TOKEN
services:
- name: clickhouse/clickhouse-server:23.10
alias: clickhouse
variables:
CLICKHOUSE_DB: test
CLICKHOUSE_DEFAULT_ACCESS_MANAGEMENT: 1
CLICKHOUSE_PASSWORD: pass
CLICKHOUSE_USER: root
stages:
- push
include:
- component: $CI_SERVER_FQDN/arigaio/atlas/migrate-push@~latest
inputs:
stage: push
branches:
- main
dir: "file://migrations"
dir-name: "my-project"
dev-url: clickhouse://root:pass@localhost:9000/test
atlas-cloud-token: $ATLAS_CLOUD_TOKEN
Inputs
stage- (Optional) The CI stage to run the job in.branches- The branches to run this jobs on.working-directory- (Optional) Atlas working directory, default is project rootconfig- (Optional) The path to the Atlas configuration file. See: https://atlasgo.io/atlas-schema/projects.env- (Optional) The environment to use from the Atlas configuration file. For example,dev.vars- (Optional) A JSON object containing variables to be used in the Atlas configuration file. For example,{"var1": "value1", "var2": "value2"}.dev-url- (Optional) The URL of the dev-database to use for analysis. For example:mysql://root:pass@localhost:3306/dev. Read more about dev-databases.dir- The URL of the migration directory to lint. For example:file://migrations. Read more about Atlas URLs here: https://atlasgo.io/concepts/url.dir-name- (Optional) The name (slug) of the project in Atlas Cloud.tag- (Optional) The tag to apply to the pushed migration directory. By default the current git commit hash is used.latest- (Optional) If true, push also the "latest" tag.atlas-cloud-token- A token for Atlas Cloud.atlas-version- (Optional) Install a specific Atlas version.