Skip to content

Serialization

The GitLab lexicon serializes resources into .gitlab-ci.yml YAML. Keys are converted to snake_case and jobs use kebab-case names. Stages are automatically collected from all job definitions.

Run chant build to produce a .gitlab-ci.yml from your declarations:

Terminal window
chant build
# Writes dist/.gitlab-ci.yml

The generated file includes:

  • stages: list — automatically collected from all job stage properties
  • default: section — if a Default resource is exported
  • workflow: section — if a Workflow resource is exported
  • Job definitions with snake_case keys and kebab-case job names
Chant (TypeScript)YAML outputRule
export const buildApp = new Job({...})build-app:Export name → kebab-case job key
expire_in: "1 week"expire_in: 1 weekProperty names use spec-native snake_case
new Image({ name: "node:20" })image: node:20Single-property objects are collapsed

The output is standard GitLab CI YAML. Validate with the GitLab CI Lint API or locally:

Terminal window
# Using the GitLab API
curl --header "PRIVATE-TOKEN: $GITLAB_TOKEN" \
--data-urlencode "content=$(cat dist/.gitlab-ci.yml)" \
"https://gitlab.com/api/v4/ci/lint"
# Using the glab CLI
glab ci lint dist/.gitlab-ci.yml

The output is compatible with:

  • GitLab CI/CD (any recent GitLab version)
  • GitLab CI Lint API
  • glab CLI tool
  • Any tool that processes .gitlab-ci.yml files