GitLab CI Config, Intentionally Invalid
An intentionally invalid GitLab CI config: valid YAML with a misspelled `stagess` key, a job naming an undeclared stage, a job with no script, and an `only:` given a bare scalar. For testing that a linter rejects it and names each fault.
# INTENTIONALLY INVALID. Well-formed YAML, invalid GitLab CI in four documented ways:
# 1. `stagess:` is not a keyword, so `stages` is never declared
# 2. the `build` job names a stage that does not exist
# 3. the `test` job has neither `script` nor `trigger` nor `extends`
# 4. `only:` is given a mapping where a sequence or a keyed mapping of refs is required
stagess:
- build
- test
build:
stage: compile
script:
- make build
test:
stage: test
needs: [build]
lint:
stage: test
script:
- npm run lint
only: main
Specifications
- System
- GitLab CI
- Variant
- intentionally invalid
- Yaml Well Formed
- true
- Config Violations
- 4
Testing contract
Expected to fail- Scenario
- Lint a well-formed YAML document against the GitLab CI configuration rules
- Expected result
- YAML parsing succeeds and linting fails with at least 4 findings, including the job whose stage was never declared
What is a .yml file?
YML is an alternate file extension for YAML, a human-readable data-serialization format based on indentation, key-value mappings, and lists. The content and parsing rules are identical to .yaml; only the extension differs. It is widely used for CI and application configuration files.
How to use this file
Use an example YML file to test that config loaders treat .yml and .yaml identically, and to exercise indentation, comment, and multi-document parsing.
How to use this file for testing
“GitLab CI Config, Intentionally Invalid” is a deterministic Novus Examples fixture for Error handling, Config parsing, Schema validation. Deliberately corrupt and invalid files, clearly labelled, for testing how your tool fails.
Documented properties for this file: YML · 551 bytes. Compare results against paired or grouped companions on this page when present (clean↔damaged, searchable↔scanned, or format twins) so scores stay reproducible across runs.
Download the file once, keep the path stable in CI or local scripts, and treat the spec table as the contract: dimensions, seeds, field lists, and roles are intentional. Corrupt or invalid samples are labelled as such — expect parsers to fail loudly rather than silently accept them.
Pipeline and infrastructure fixtures are inert configuration: steps reference fictional images and scripts, and nothing here executes. Run your linter, schema validator, migrator, or policy engine against them, and expect the deprecated-syntax and intentionally invalid variants to be rejected.
Code examples
import yaml # pip install pyyaml
with open("gitlab-ci-invalid.yml") as f:
data = yaml.safe_load(f)
print(data)Related files
- ymlAzure Pipelines, Intentionally InvalidAn intentionally invalid Azure Pipelines file: valid YAML that mixes top-level steps with a stages block, depends on an undeclared stage, and gives `pool` a bare string. For testing that a validator rejects it and reports all three faults.

- ymlCircleCI Config, Intentionally InvalidAn intentionally invalid CircleCI config: an unquoted `version: 2.10` that YAML loads as the float 2.1, a workflow referencing an undefined job, and a job with no execution environment. For testing that a validator rejects it and explains each fault.

- cwlCWL Workflow, Intentionally InvalidAn intentionally invalid CWL document: a nonexistent cwlVersion, an unknown class, a step consuming an output no step produces, and outputs given as a bare string. Four documented faults for a CWL validator to report.

- yamlDocker Compose File, Intentionally InvalidAn intentionally invalid Compose file: services as a list, a service with both image and an empty build, an unquoted 8080:8080 port that YAML 1.1 reads as a base-60 integer, and a depends_on naming an undefined service.

- ymlGitHub Actions Workflow, Intentionally InvalidAn intentionally invalid GitHub Actions workflow: well-formed YAML that breaks the workflow schema in four documented ways — no jobs mapping, a scalar `on`, a mapping `runs-on`, and a step carrying both uses and run. For testing that a validator rejects, and reports why.

- hclHCL2 Document, Intentionally InvalidAn intentionally invalid HCL2 document: an unclosed block, a colon assignment, a half-quoted block label, and a heredoc whose terminator is misspelled so it swallows the remainder of the file. Four documented faults, each a distinct recovery test.

Generated by generation/pipelines.py. Free for any use, no attribution required — license.