Skip to main content

Module parser

Module parser 

Source
Expand description

.gitlab-ci.yml-syntax parser using yaml-rust2’s event-driven (MarkedEventReceiver) API.

Tracks the top-level include: key’s value and, within it, each entry’s project:/ref:/component:/template:/remote:/local: keys — template:, remote: and a local: key (or a bare-string include: list item, GitLab’s local: shorthand) are recognized and skipped gracefully (spec FR-003); image:/services: entries are never visited at all, since they never appear under include: (FR-016 falls out for free).

§Multi-document input

A GitLab CI component file uses the spec: header form (spec: … \n--- \n job:). Per-document parser state is reset at each Event::DocumentStart/DocumentEnd, so document 1’s nesting never mis-scopes document 2’s top-level include:.

§Host resolution and the per-document fan-out cap

Every dependency’s host is resolved here (not deferred to the registry), since the per-document cap on distinct literal component: hosts (spec plan §4.6) must be enforced at the point a host string first turns into a fetch target. A project: include (which never carries a host segment) and a $CI_SERVER_FQDN-relative component: include resolve against registries.gitlab_instance_host when set, or are left crate::types::HostRef::Unresolved otherwise (spec FR-011a/FR-012).

Functions§

parse_gitlab_ci_yaml
Parses a .gitlab-ci.yml-syntax file and returns every include: dependency found, with LSP position tracking, host resolution, and routing.