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
Basic Syntax Check
- YAML format must be correct
- Indentation must use 2 spaces
- Tab characters are not allowed
Required Field Validation
version: 1.0 # Required, specifies configuration file version
stages: # Required, defines pipeline stages
jobs: # Required, defines specific tasksField Type Validation
version
: stringstages
: arrayjobs
: objectscript
: string array
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:
- Immediate feedback during commit
- Build logs in the CI/CD page
- Status checks in merge requests
Common Errors and Solutions
Indentation Error
# Incorrect example
jobs:
build: # Should be indented 2 spaces
script:
- echo "Hello"Missing Required Fields
# Correct example
version: 1.0
stages:
- build
jobs:
build:
script:
- echo "Hello"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