Skip to content

Preserve pack metadata for jobs with top-level blocks like locals#892

Open
gautamg795 wants to merge 2 commits into
hashicorp:mainfrom
gautamg795:codex/allow-top-level-nomad-hcl-metadata
Open

Preserve pack metadata for jobs with top-level blocks like locals#892
gautamg795 wants to merge 2 commits into
hashicorp:mainfrom
gautamg795:codex/allow-top-level-nomad-hcl-metadata

Conversation

@gautamg795

Copy link
Copy Markdown

Description
Nomad Pack injects pack.* metadata into rendered job files so later plan, run, stop, and destroy commands can identify jobs managed by the same pack deployment.

The metadata injection path currently parses the rendered file with a schema that only permits top-level job blocks. If a valid Nomad job file also contains another top-level block, such as locals, that parse reports diagnostics and Nomad Pack skips metadata injection. The job can still be submitted, but it loses the pack.* metadata and future Nomad Pack operations treat it as unmanaged.

This changes the metadata injection parser to use PartialContent, so it can find top-level job blocks while preserving unrelated top-level HCL blocks. A regression test covers a job file with top-level locals.

Reminders

  • Add CHANGELOG.md entry

Changes to Security Controls

Are there any changes to security controls (access controls, encryption, logging) in this pull request? If so, explain.

No. This does not change access controls, encryption, logging, or other security controls.

@gautamg795 gautamg795 requested review from a team as code owners May 21, 2026 00:59
@hashicorp-cla-app

hashicorp-cla-app Bot commented May 21, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant