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
  • starter
  • 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.

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"]
info
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? We're here to help.

Join the RudderStack Slack community or email us for support