Skip to content

Allow to use component.reference, component.sha, component.version and component.name#1836

Open
jrd wants to merge 5 commits into
firecow:masterfrom
jrd:master
Open

Allow to use component.reference, component.sha, component.version and component.name#1836
jrd wants to merge 5 commits into
firecow:masterfrom
jrd:master

Conversation

@jrd

@jrd jrd commented Apr 20, 2026

Copy link
Copy Markdown

When including another component B from a component A, allow to use $[[ component.reference ]] notation for component B.

@jrd jrd changed the title Allow to use components.reference or components.sha Allow to use component.reference or component.sha Apr 20, 2026

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 issues found across 1 file

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Comment thread src/parser-includes.ts Outdated
Comment thread src/parser-includes.ts Outdated
@firecow

firecow commented May 9, 2026

Copy link
Copy Markdown
Owner

Apply cubic's component\. suggestion — it's still open. And drop the compList.includes(...) check in getComponentValue; upstream GitLab doesn't require declaring spec.component, so just always allow reference, version, sha.

@jrd

jrd commented May 29, 2026

Copy link
Copy Markdown
Author

I updated my pull request, also borrowing the better idea from #1839

It should be all good now.

jrd added 2 commits May 29, 2026 23:52
Like $[[ component.sha ]]

Co-Author: nhoff <nils.hoff@inform-software.com>
@jrd jrd changed the title Allow to use component.reference or component.sha Allow to use component.reference, component.sha, component.version and component.name May 29, 2026
Comment thread src/parser-includes.ts Outdated
@firecow

firecow commented May 31, 2026

Copy link
Copy Markdown
Owner

One behavior note (not blocking): getComponentSha runs a full git ls-remote on every remote component include, even when the template never uses $[[ component.sha ]]. Previously only semver ranges hit the network. Could the SHA be resolved lazily — only when the placeholder is actually present?

Co-authored-by: Mads Jon Nielsen <madsjon@gmail.com>
@jrd

jrd commented May 31, 2026

Copy link
Copy Markdown
Author

One behavior note (not blocking): getComponentSha runs a full git ls-remote on every remote component include, even when the template never uses $[[ component.sha ]]. Previously only semver ranges hit the network. Could the SHA be resolved lazily — only when the placeholder is actually present?

Yes, a lazy version is preferable in that case. I see what I can manage to do it in typescript. If I can find a better solution, a lambda/arrow function will do it.

[Edit] I think typescript have property, at least there is getter function in javascript, that could do the trick to compute it only when required.

@jrd

jrd commented May 31, 2026

Copy link
Copy Markdown
Author

@firecow Do you want me to squash the last two commits with the first one?

@firecow

firecow commented Jun 3, 2026

Copy link
Copy Markdown
Owner

@firecow Do you want me to squash the last two commits with the first one?

Nah, don't care.. I'll squash into master anyway

@jrd

jrd commented Jun 4, 2026

Copy link
Copy Markdown
Author

So… what’s missing for merge?

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.

2 participants