Repository navigation
Accept :tag as an alias for :ref when parsing git modules - #4
Merged
dploeger merged 2 commits intoNov 26, 2026
Merged
Conversation
A Puppetfile line with `mod 'x-y', :git => '...', :tag => 'v1'` is valid r10k syntax, but the parser only knew about `:ref`. The `:tag` parameter was silently dropped, `this.ref` stayed undefined, and `fetchGitMetadata()` skipped the checkout step. metadata.json was then read from the repository's default branch instead of the tagged commit, which made the resolver pick up dependency ranges that the tag no longer carries. The only symptom was an unrelated-looking range conflict like `No possible version for requirement x => y (<9.0.0)`. Treat `:tag` as an alias for `:ref`; simpleGit's checkout handles tags, branches, and SHAs identically, so no other call site needs to change.
Member
|
Supporting :tag in .toText would be nice as well, but as only we're using this, this PR should be sufficient for the moment. |
dploeger
approved these changes
Nov 26, 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.
Problem
A Puppetfile line of the form
mod 'x-y', :git => '...', :tag => 'v1'is valid r10k syntax.ModuleDeclaration.fromText()only looks for:refin the parsed parameters, so:tagis silently dropped.this.refstays undefined,fetchGitMetadata()skips thecheckoutstep, andmetadata.jsonis read from the repository's default branch. If the default branch carries different metadata than the tag, the resolver sees the wrong dependency ranges.The user-facing symptom is confusing because the error message blames the Puppetfile module, not the parser. In our case the Puppetfile pins
meltwater-cpanto a tag whosepuppetlabs-stdlibrange is>= 9.0.0 < 11.0.0, but the resolver was reading themasterbranch whose range is still>= 4.6.0 < 10.0.0. Combined with other modules that need stdlib 10, the resolve failed with:Change
lib/ModuleDeclaration.ts: when:refis absent, fall back to:tag.simpleGit().checkout()handles tag names, branch names, and SHAs the same way, so no other call site needs to change.test/module.declaration.test.ts: new unit test that sets up a temporary git repo with a tag and asserts thatmod '…', :git => '…', :tag => 'v1.0.0'yieldsdeclaration.ref === 'v1.0.0'.Known side effect
PuppetFile.toText()only renders:ref => '{{ref}}'. A round-trip of a Puppetfile that used:tagwill come out with:ref. Behaviourally equivalent for r10k, but worth mentioning if anyone diff-checks generated output. Not addressed here to keep the fix focused; happy to add a:tagfield and template rendering in a follow-up if you want it.