YAML lint component
This component manages linting of YAML files. By default this component applies a configuration with reasonable settings for software projects.
Usage
Example with one custom setting
- Create a new pipeline file
include:
- component: $CI_SERVER_FQDN/xrow-public/ci-tools/common@stable
- component: $CI_SERVER_FQDN/xrow-public/ci-tools/lint-yaml@stable
- Create a file
.yamllintrc.yamlto customize the configuration.
---
extends: default
Validate files against a schema
Set schema to a local JSON, JSON5, YAML, or CommonJS schema file. The shared
finder passes every file selected by path, patterns, and ignore-from-file
to both yamllint and AJV.
include:
- component: $CI_SERVER_FQDN/xrow-public/ci-tools/common@stable
- component: $CI_SERVER_FQDN/xrow-public/ci-tools/lint-yaml@stable
inputs:
schema: schemas/helm.json
path: chart
patterns:
- Chart.yaml
- values.yaml
ignore-from-file:
- .gitignore
- .yamlignore
schema can also be an HTTP(S) URL that returns a JSON schema. Schema validation
is skipped when schema is empty.
Inputs
| Name | Description | Default | Type |
| --- | --- | --- | --- |
| allow-failure | Should the pipeline fail if the test fails? | true | boolean |
| config-file | The contents of the configuration file, if none exists. | --- extends: default ignore: - '**/templates/**' - '**/node_modules/**' - 'release/**' rules: indentation: level: warning line-length: level: warning document-start: level: warning new-line-at-end-of-file: level: warning | string |
| config-file-path | The path of the configuration file. | .yamllint.yaml | string |
| ignore-from-file | Gitignore-style files used to exclude discovered files. | [".gitignore",".yamlignore"] | array |
| opts | The options to pass to yamllint. | string | |
| path | The path to lint. | . | string |
| patterns | File name patterns passed to the shared file finder. | ["*.yaml","*.yml"] | array |
| rules | The rules that this job depends on. | [{"if":"$CI_PIPELINE_SOURCE == \"schedule\"","when":"never"},{"exists":["**/*.yaml","**/*.yml"],"when":"on_success"},{"when":"never"}] | array |
| schema | Local schema path or HTTP(S) schema URL. Empty disables schema validation. | string |