Select spec version:

Automate Project Management with Rudder CLI and GitLab CI/CD Beta

Leverage GitLab CI/CD for automating validation and deployment of your Rudder CLI projects.
Available Plans
  • free
  • growth
  • enterprise

This guide shows how to run the same validate and apply workflow you use locally inside a GitLab pipeline.

Prerequisites

Example pipeline

The following .gitlab-ci.yml sketches a two-stage flow: validate on every branch, apply only on the default branch after validation succeeds. Adjust image, paths, and branch rules to match your environment.

yaml
stages:
  - validate
  - apply

variables:
  RUDDER_PROJECT_PATH: "$CI_PROJECT_DIR/my-rudder-project"

validate:
  stage: validate
  image: rudderlabs/rudder-cli
  script:
    - rudder-cli validate -l "$RUDDER_PROJECT_PATH"
  rules:
    - if: $CI_PIPELINE_SOURCE == "merge_request_event"
    - if: $CI_COMMIT_BRANCH

apply:
  stage: apply
  image: rudderlabs/rudder-cli
  script:
    - rudder-cli apply -l "$RUDDER_PROJECT_PATH" --dry-run
    - rudder-cli apply -l "$RUDDER_PROJECT_PATH"
  rules:
    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
  needs: ["validate"]
Use the official CLI image only if it matches the version you run locally. Alternatively install the binary in the job (for example from GitHub releases) so versions stay aligned with Install Rudder CLI.

See more

Questions? Let's figure it out together.

Join the RudderStack Slack community to connect with other users, customers, and the RudderStack team — or reach out for direct support.