Trigger GitLab Pipeline

Action ID: gitlab:pipeline:trigger
NPM Package:

@backstage/plugin-scaffolder-backend-module-gitlab

Description

Triggers a GitLab Pipeline.

Input Schema

PropertyTypeDescriptionRequired
tokenstringThe token to use for authorization to GitLab
branchstringProject branch
repoUrlstring-
projectIdnumberProject Id
variablesobject-
tokenDescriptionstringPipeline token description

Output Schema

PropertyTypeDescriptionRequired
pipelineUrlstringPipeline Url

Usage Examples

Trigger a CI pipeline on a feature branch with basic variables

Triggers a pipeline for a feature branch on an existing GitLab project. Use this to kick off CI after generating project files.

Copy
steps:
  - id: fetch-base
    action: fetch:template
    input:
      url: ./skeleton
      targetPath: ./workspace

  - id: trigger-ci
    action: gitlab:pipeline:trigger
    input:
      repoUrl: gitlab.com?owner=platform&repo=payments-service
      projectId: 4973211
      tokenDescription: Backstage CI trigger for ${{ parameters.serviceName }}
      branch: ${{ parameters.branch }}
      variables:
        DEPLOY_ENV: dev
        RUN_TESTS: "false"
        SERVICE_NAME: ${{ parameters.serviceName }}

  - id: log-pipeline
    action: debug:log
    input:
      message: Triggered pipeline URL ${{ steps.trigger-ci.output.pipelineUrl }}

Trigger a pipeline on a self managed GitLab instance with an explicit token

Triggers a pipeline against a self managed GitLab host using an explicit token. Useful when you do not rely on configured integrations.

Copy
steps:
  - id: fetch-base
    action: fetch:template
    input:
      url: ./templates/svc
      targetPath: ./workspace

  - id: trigger-release
    action: gitlab:pipeline:trigger
    input:
      repoUrl: gitlab.internal.example.com?owner=platform/delivery&repo=inventory-api
      projectId: 120998
      token: ${{ secrets.gitlabToken }}
      tokenDescription: Backstage trigger token for inventory release
      branch: release/2025.10
      variables:
        DEPLOY_ENV: staging
        IMAGE_TAG: ${{ parameters.imageTag }}
        SKIP_TESTS: "true"

  - id: log-pipeline
    action: debug:log
    input:
      message: Triggered pipeline URL ${{ steps.trigger-release.output.pipelineUrl }}

Trigger a pipeline with dynamic variables from template and user context

Starts a pipeline on the main branch and passes dynamic variables based on template inputs and the current user.

Copy
steps:
  - id: fetch
    action: fetch:template
    input:
      url: ./template
      targetPath: .

  - id: trigger-main
    action: gitlab:pipeline:trigger
    input:
      repoUrl: gitlab.com?owner=data&repo=analytics-pipeline
      projectId: ${{ parameters.gitlabProjectId }}
      tokenDescription: Backstage one off CI for analytics
      branch: main
      variables:
        TRIGGERED_BY: ${{ user.entity.metadata.name }}
        PIPELINE_SOURCE: backstage
        RUN_MIGRATIONS: "true"
        IMAGE_TAG: ${{ parameters.imageTag }}

  - id: log
    action: debug:log
    input:
      message: Triggered pipeline URL ${{ steps.trigger-main.output.pipelineUrl }}

Trigger a hotfix pipeline for a subgroup project

Runs a pipeline for a project in a subgroup using a hotfix branch name. Use this when applying a production hotfix.

Copy
steps:
  - id: fetch-template
    action: fetch:template
    input:
      url: ./service-template
      targetPath: ./service

  - id: trigger-hotfix
    action: gitlab:pipeline:trigger
    input:
      repoUrl: gitlab.com?owner=platform/infra&repo=config-service
      projectId: 331200
      tokenDescription: Hotfix trigger token
      branch: hotfix/1.2.3
      variables:
        DEPLOY_ENV: production
        HOTFIX_ID: HF-1234
        APPROVER: ${{ parameters.approver }}

  - id: log-hotfix
    action: debug:log
    input:
      message: Triggered pipeline URL ${{ steps.trigger-hotfix.output.pipelineUrl }}

Trigger a monorepo pipeline for a specific service

Triggers a pipeline in a monorepo and passes service specific variables to target downstream jobs.

Copy
steps:
  - id: fetch
    action: fetch:template
    input:
      url: ./mono
      targetPath: ./work

  - id: trigger-mono
    action: gitlab:pipeline:trigger
    input:
      repoUrl: gitlab.com?owner=platform&repo=mono-repo
      projectId: 774123
      tokenDescription: Backstage monorepo service deployment
      branch: ${{ parameters.targetBranch }}
      variables:
        SERVICE_NAME: ${{ parameters.service }}
        AFFECTED_PATH: services/${{ parameters.service }}
        TRIGGER_DOWNSTREAM: "true"
        APPROVAL_REQUIRED: "false"

  - id: log-mono
    action: debug:log
    input:
      message: Triggered pipeline URL ${{ steps.trigger-mono.output.pipelineUrl }}