Skip to content

Yamllint GitLab CI Component

A GitLab CI component for yamllint - a linter for YAML files that checks for syntax validity and enforces coding standards.

Features

  • Syntax & Style Checks: Ensures your YAML files adhere to defined rules and best practices
  • Custom Configuration: Supports local and remote configuration files
  • Flexible File Selection: Lint specific patterns or entire directories
  • Extra Arguments: Pass additional flags directly to the yamllint CLI
  • Remote Configuration: Download and use configuration files from remote URLs
  • Configurable Job Settings: Customise job name, stage, and container image

Usage

Basic Usage

include:
  - component: $CI_SERVER_FQDN/niclas-zone/ci/yamllint/main@1.2.1

stages:
  - lint

With Custom Configuration

include:
  - component: $CI_SERVER_FQDN/niclas-zone/ci/yamllint/main@1.2.1
    inputs:
      YAMLLINT_CONFIG: ".yamllint"
      YAMLLINT_EXTRA_ARGS: "--strict"

With Remote Configuration

include:
  - component: $CI_SERVER_FQDN/niclas-zone/ci/yamllint/main@1.2.1
    inputs:
      YAMLLINT_REMOTE_CONFIG: "https://gitlab.com/niclas-zone/ci/yamllint/-/raw/main/.gitlab/.yamllint"

Inputs

Input Description Default
job_name Name of the CI job "yamllint"
stage Pipeline stage "lint"
image Docker image for running yamllint "registry.gitlab.com/niclas-zone/ctr/yamllint:1.37.1"
YAMLLINT_CONFIG Path to yamllint config file ".yamllint"
YAMLLINT_EXTRA_ARGS Extra arguments for the yamllint command ""
YAMLLINT_REMOTE_CONFIG URL to download yamllint config file ""