A job is recognised only if its body has a script key:
if jobMap, ok := toStringAnyMap(doc[key]); ok {
if _, hasScript := jobMap["script"]; hasScript {
A trigger job has no script — that is what makes it a trigger job. It falls through to the generic top-level branch, which warns and writes the map as a bare block named after the key:
build:
script: [make]
deploy:
trigger:
include:
- local: .gitlab/child.yml
strategy: depend
rules:
- if: '$CI_COMMIT_BRANCH == "main"'
when: manual
unparse:
warning: unsupported top-level key 'deploy' passed through
deploy {
rules = [{ ... }]
trigger {
include = [{ local = ".gitlab/child.yml" }]
strategy = "depend"
}
}
parse: Blocks of type "deploy" are not expected here.
The job is silently demoted and the file it produces does not parse. hclJobBlock already has a Trigger field, so the block shape is supported — only the detection is wrong.
Jobs with no script are ordinary GitLab: trigger jobs, and jobs that inherit script through extends. Detection should be "a top-level map that is not a reserved key and is not hidden (.-prefixed)" rather than "has a script". validatePipeline already enforces that a non-template job has a script somewhere in its chain, so the check does not need to live in the writer.
A job is recognised only if its body has a
scriptkey:A
triggerjob has noscript— that is what makes it a trigger job. It falls through to the generic top-level branch, which warns and writes the map as a bare block named after the key:unparse:
parse:
Blocks of type "deploy" are not expected here.The job is silently demoted and the file it produces does not parse.
hclJobBlockalready has aTriggerfield, so the block shape is supported — only the detection is wrong.Jobs with no
scriptare ordinary GitLab:triggerjobs, and jobs that inheritscriptthroughextends. Detection should be "a top-level map that is not a reserved key and is not hidden (.-prefixed)" rather than "has a script".validatePipelinealready enforces that a non-template job has a script somewhere in its chain, so the check does not need to live in the writer.