Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(templates): allow templating in template path #6736

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

thsig
Copy link
Collaborator

@thsig thsig commented Dec 20, 2024

What this PR does / why we need it:

Added a new template variable for RenderTemplate configs: ${template.path}. This is the relative path (from the project root) to the config template being rendered. This is useful when you want to use the full path to a file or directory next to the ConfigTemplate that's being rendered (e.g. to use a shared Dockerfile that belongs the template, every time you render that template).

Which issue(s) this PR fixes:

Addresses a limitation raised by a user on Discord: https://discord.com/channels/817392104711651328/1318995192501764151

@thsig thsig requested a review from stefreak December 20, 2024 12:01
Comment on lines 319 to 327
@schema(joi.string().description(`The absolute path to the directory containing the ConfigTemplate being rendered.`))
public path: string
Copy link
Member

Choose a reason for hiding this comment

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

Wouldn't this cause an issue where the version calculation is different depending on the directory where the git repository has been checked out in?
Also, most of the time we do not accept absolute paths in the action specs.
Maybe we need to calculate the relative path to the ConfigTemplate from the location of the RenderConfigTemplate.

See also https://discord.com/channels/817392104711651328/1318995192501764151/1319639199036735500

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ah yeah, that's a good point. Relative paths would avoid the versioning problem.

@thsig thsig marked this pull request as draft January 16, 2025 12:43
Added a new template variable for `RenderTemplate` configs:
`${template.path}`. This is the relative path from the project root
to the config template being rendered. This is useful when you want
to use the full path to a file or directory next to the
`ConfigTemplate` that's being rendered (e.g. to use a shared
Dockerfile that belongs the template, every time you render that
template).
@thsig thsig force-pushed the add-template-path-to-parent-context branch from 7df72a3 to 5451d21 Compare February 18, 2025 14:07
@thsig thsig marked this pull request as ready for review February 18, 2025 14:08
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