Skip to main content

CI/CD Pipelines

The validator exits with code 1 when any file fails validation, making it usable in any CI system that checks exit codes. Use --reporter to produce machine-readable output.

GitLab CI

validate-config:
stage: test
image: golang:1.26
script:
- go install github.com/Boeing/config-file-validator/v2/cmd/validator@latest
- validator --reporter=junit:results.xml --schemastore .
artifacts:
reports:
junit: results.xml

Jenkins

stage('Validate Config') {
steps {
sh 'validator --reporter=junit:results.xml --schemastore .'
}
post {
always {
junit 'results.xml'
}
}
}

Azure DevOps

- script: |
go install github.com/Boeing/config-file-validator/v2/cmd/validator@latest
validator --reporter=junit:results.xml --schemastore .
displayName: 'Validate config files'

- task: PublishTestResults@2
inputs:
testResultsFiles: 'results.xml'
testResultsFormat: 'JUnit'
condition: always()

Output formats for CI

FormatFlagUse case
JUnit--reporter=junit:results.xmlJenkins, GitLab, Azure DevOps
SARIF--reporter=sarif:results.sarifGitHub Code Scanning
JSON--reporter=json:results.jsonCustom tooling, scripts

Multiple reporters can run in a single invocation:

validator --reporter=junit:results.xml --reporter=sarif:results.sarif --schemastore .

Exit codes

CodeMeaning
0All files valid
1One or more validation errors
2Runtime or configuration error

Use exit code 1 as your CI gate. Exit code 2 indicates a problem with the validator invocation itself (bad flags, unreadable files).