Skip to main content
Version: 1.1.0

CI/CD Configuration File Validation Guide

Configuration File Format

GitLink uses .gitlink-ci.yml as the CI/CD configuration file, which is automatically validated for syntax when committed.

Validation Rules

  1. Basic Syntax Check

    • YAML format must be correct
    • Indentation must use 2 spaces
    • Tab characters are not allowed
  2. Required Field Validation

    version: 1.0  # Required, specifies configuration file version
    stages: # Required, defines pipeline stages
    jobs: # Required, defines specific tasks
  3. Field Type Validation

    • version: string
    • stages: array
    • jobs: object
    • script: string array
  4. Environment Variable Format

    • Variable names can only contain letters, numbers, and underscores
    • Variable names must start with a letter

Error Message Description

When there are issues with the configuration file, the system will display error messages in the following locations:

  1. Immediate feedback during commit
  2. Build logs in the CI/CD page
  3. Status checks in merge requests

Common Errors and Solutions

  1. Indentation Error

    # Incorrect example
    jobs:
    build: # Should be indented 2 spaces
    script:
    - echo "Hello"
  2. Missing Required Fields

    # Correct example
    version: 1.0
    stages:
    - build
    jobs:
    build:
    script:
    - echo "Hello"
  3. Environment Variable Format Error

    # Incorrect example
    variables:
    1_invalid: "value" # Variable name cannot start with a number

Configuration File Template

version: 1.0
stages:
- build
- test
- deploy

variables:
MAVEN_OPTS: "-Dmaven.repo.local=.m2/repository"

jobs:
build:
stage: build
script:
- mvn compile

test:
stage: test
script:
- mvn test