Skip to content

GitLabForm GitLab CI Component

A GitLab CI component for GitLabForm - a tool for automated management and application of GitLab configuration using declarative configuration files.

Features

  • Configuration Validation: Execute GitLabForm in dry-run mode to verify configuration validity
  • Configuration Application: Apply GitLabForm configuration to GitLab projects or groups
  • Pre-run Validation: Ensure critical environment variables are defined before execution
  • Flexible Customisation: Support for custom job names, stages, and GitLabForm options
  • Test Stage Integration: Option to require test stage completion before applying configuration
  • Configurable Job Settings: Customise job name, stage, and container image

Usage

Basic Usage

include:
  - component: $CI_SERVER_FQDN/niclas-zone/ci/gitlabform/main@latest

stages:
  - test
  - deploy

variables:
  GITLAB_TOKEN: "$GF_TOKEN"

With Custom Configuration

include:
  - component: $CI_SERVER_FQDN/niclas-zone/ci/gitlabform/main@latest
    inputs:
      check_job_name: "Gitlabform check"
      apply_job_name: "Gitlabform apply"
      gf_config: "config.yml"
      test_gf_options: "--noop --strict"
      deploy_gf_options: "--strict"

variables:
  GITLAB_TOKEN: "$GF_TOKEN"

With Custom Stages

include:
  - component: $CI_SERVER_FQDN/niclas-zone/ci/gitlabform/main@latest
    inputs:
      test_stage: "validation"
      deploy_stage: "apply"
      require_test_stage: true

variables:
  GITLAB_TOKEN: "$GF_TOKEN"

Inputs

Input Description Default
check_job_name Name of the CI job for GitLabForm configuration check "Gitlabform check"
apply_job_name Name of the CI job for GitLabForm configuration apply "Gitlabform apply"
test_stage Pipeline stage for the configuration check job "test"
deploy_stage Pipeline stage for the configuration apply job "deploy"
image Docker image for running GitLabForm "ghcr.io/gitlabform/gitlabform:4"
gf_config Path to the GitLabForm configuration file "config.yml"
gf_run Value for GF_RUN variable (which projects or groups to target) "ALL_DEFINED"
test_gf_options Command-line options for GitLabForm in test (dry-run) mode "--noop --strict"
deploy_gf_options Command-line options for GitLabForm when applying configuration "--strict"
require_test_stage Require test stage job completion before applying configuration true