
GitLab CI: Format and Validate Your .gitlab-ci.yml Online
Stages, includes, `rules:`: structurally validate a .gitlab-ci.yml before the pipeline runs — not a GitLab runner, not official CI Lint.
Checking a .gitlab-ci.yml before the pipeline runs
A .gitlab-ci.yml that does not parse, a stages value that is not an array, or a job with neither script nor trigger often shows up too late. You then see a red badge in the Pipeline Editor and a blocked merge. FastMinify does not ship GitLab’s official CI Lint and does not run a runner. The GitLab CI validator runs structural checks in the browser (root mapping, stages, jobs with script or trigger, include, hidden jobs .). The GitLab CI formatter fixes the YAML indentation to 2 or 4 spaces. The full cluster lives on the CI/CD tools hub. To minify JS/CSS in the same pipeline, see the CI/CD minification guide.
GitLab versus GitHub Actions, two YAML shapes in three layers
GitHub Actions lives under .github/workflows/*.yml (many files, on trigger, jobs with steps). GitLab CI almost always lives in a single .gitlab-ci.yml at the repo root: stages, named jobs, include. FastMinify tools follow that split, so do not paste an Actions workflow into the GitLab validator.
jobs map plus required on, see the GitHub Actions guideFastMinify exposes two tools. Neither is GitLab CI Lint. Mixing the three up produces a file that looks “valid” here and still fails in Pipeline Editor.
js-yaml round-trip with a 2- or 4-space indent (default 2), see format-gitlab-ciinclude expansion, and rules: evaluation, through the Pipeline Editor UI, the API, or glab ci lintrules: clause selects the jobThe validator does not talk to a GitLab runner, does not call the CI Lint API, and does not expand remote includes. The rules: clause is a real GitLab feature, and it is not evaluated in the browser.
script execution, no Docker image, no runner cacheinclude: remote or include: project expansion, since only the pasted YAML is readrules:, only/except, or workflow:rulespages jobs are jobs like any other: they need script or triggerWhat FastMinify checks in the anatomy of a .gitlab-ci.yml
The root must be a YAML mapping, not a scalar or a list. There is only one document, and repeated --- is rejected. If stages is present, it must be an array of non-empty names. Every key that is not reserved and does not start with . is a job, and it needs script (non-empty string or list) or trigger.
stages, variables, include, workflow, default, image, services, cache, before_script, after_script, spec.hidden: no script requirementextends gets a warning, since a parent must provide script or triggerinclude: warning, not always a blockerThe formatter pretty-prints via js-yaml. It is not a semantic rewriter: key order may change, # comments disappear, indent becomes 2 or 4 spaces.
Before
After
A top-level include is enough to avoid the “no jobs” warning. FastMinify does not download included files. Above 512 KiB UTF-8, input is rejected, the same as other DevOps tools on the site.
include counter: a scalar counts as 1; an array counts its lengthrules: in the pasted YAML are not interpretedglab ci lint locallyValidate, then format, as a concrete workflow
Open the GitLab CI validator, paste a single .gitlab-ci.yml (max 512 KiB), and wait for the short debounce delay (~300 ms). The panel shows a verdict, issues (parse errors with a line hint), and job, stage, and include counts.
The GitLab CI formatter rewrites YAML through js-yaml. Paste, upload, or load the sample, and it formats automatically. After a manual edit, use the Format button. This step does not prove the structure is complete.
A teammate added compile: with only stage: build. GitLab refuses the pipeline, often with a message that is hard to read in the MR overlay.
Paste the file into validate-gitlab-ci
Open validate-gitlab-ci. An invalid verdict such as “Job … needs script or trigger” points at the empty job.
Add script or trigger
Add script: [npm run build] or a real trigger:. Re-paste until the panel shows a valid structure (extends warnings may remain).
Format and open the MR
Send the fixed YAML through format-gitlab-ci, copy it, and commit. Reviewers read indented jobs, not a one-line blob.
An example copied from GitLab docs or a snippet arrives with mixed spaces. You can no longer see where a job ends.
Format first if you cannot even read the file
Paste into format-gitlab-ci. This step does not prove the config is structurally complete.
Validate the indented document
Copy the output into the validator. Check stages, every job, and that . templates are not hiding a broken visible job.
Keep CI Lint for includes and rules
Once the shape is OK, schema, remote includes, and rules: stay in GitLab, because FastMinify does not replace that gate.
Keep GitLab CI Lint (and minify) in the chain
The browser is the fast loop for YAML plus structure. GitLab already refuses to create a pipeline if the official schema is invalid, which is why teams rarely embed a “lint CI” job in the same file. Locally, glab ci lint (the official CLI, authenticated to the project) calls CI Lint with merged includes and an optional --dry-run simulation. Pin your glab version, because FastMinify does not replace that call. To minify JS/CSS in the pipeline, see the CI/CD minification guide.
Basic example
If the repo is on GitHub, the counterparts are format-github-actions and validate-github-actions, with the same idea of YAML plus structure and no actionlint. Dockerfile and Compose stay on the DevOps hub. A minified JS bundle produced by a job is read with unminify-js or the unminify guide, and that is not CI YAML.
Conclusion
Paste the .gitlab-ci.yml, fix the structure (mapping, stages, jobs with script/trigger), fix the indentation, then push. FastMinify runs that loop locally and never uploads the YAML. It is not GitLab CI Lint: remote includes, rules:, and the official schema stay in the UI, the API, or glab ci lint. For generic YAML, stay on beautify-yaml; for GitHub Actions, on the same CI/CD hub.
Validate or format a .gitlab-ci.yml now
Related Articles

Paste a token and a JWKS to check an RS256, ES256 or HS256 signature in your browser. How kid picks the key, measured errors and the claims to check.

HTTP/2 and HTTP/3 change how files travel, not how big they are. Measured sizes, compile times and bundling tests show what minification still saves.

Convert a Unix epoch to a readable date and back, tell seconds from milliseconds, and avoid time zone, JWT and clock change traps, all in your browser.