fix(share): push HCL configs as resolved, self-contained YAML - #4152
Merged
Conversation
`share push` sniffed the config version with yaml.Unmarshal on the raw bytes, so any HCL agent failed with "looking for version in config file". HCL configs now skip the YAML sniff and are always serialized from the loaded config, so `instruction_file` and `file()` references are inlined and a pulled artifact needs no local directory. Export config.IsHCLSource for reuse and drop the redundant cfg.Version assignment (config.Load already sets it). Assisted-By: docker-agent
trungutt
approved these changes
Sep 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
docker agent share pushwas broken for any HCL agent: the code tried to sniff the config version by unmarshalling the raw file bytes as YAML, which fails for HCL and produced the error "looking for version in config file". As a result, HCL agents — including those that reference prompts viainstruction_fileor thefile()template function — could not be pushed to OCI registries at all.The fix detects HCL sources via the newly exported
config.IsHCLSourceand skips the YAML version sniff for them. For HCL configs the pushed bytes are always serialized from the already-loaded config struct, soinstruction_filereferences andfile()calls (including template variables) are inlined into the artifact. The pushed artifact is plain YAML that needs no local directory to be useful. A redundantcfg.Version = cmp.Or(raw.Version, latest.Version)assignment was also removed —config.Loadalready sets the version correctly, and for HCL it would have clobbered a declared value.YAML
instruction_fileinlining was already supported; this closes the same gap for HCL sources. No breaking changes or follow-up work expected.