feat(task): add Tera template support for inline table run tasks#9079
feat(task): add Tera template support for inline table run tasks#9079
Conversation
…ent variables - Implemented rendering of Tera templates in task arguments and environment variables within the RunEntry structure. - Enhanced the TaskExecutor to check for Tera templates and render them accordingly during task execution. - Added e2e tests to verify the correct rendering of templates in task arguments and environment variables. This update improves the flexibility of task definitions by allowing dynamic values to be passed through templates.
There was a problem hiding this comment.
Code Review
This pull request introduces support for Tera templates within task arguments and environment variables, allowing for dynamic task configuration. It includes a new rendering mechanism in the task executor that injects 'usage' and 'env' contexts when templates are detected. Feedback suggests expanding the template detection logic to include Tera control structures and comments, as well as refactoring the Tera initialization to use more idiomatic path handling.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Greptile SummaryThis PR adds Tera template rendering support for Confidence Score: 5/5Safe to merge; both previously flagged issues are resolved and no new P0/P1 bugs found. All remaining findings are P2 style suggestions (unnecessary parse call for non-usage templates, redundant env insertion). The core logic — lazy Tera initialisation, per-entry template detection, and correct context assembly — is sound and consistent with the existing dep-rendering pattern. No files require special attention. Important Files Changed
Sequence DiagramsequenceDiagram
participant TE as TaskExecutor
participant T as Task
participant TM as task::mod
participant TR as tera::Tera
TE->>T: task.run()
TE->>TM: RunEntry::has_tera_template() × N
alt any entry has template
TE->>TM: parse_usage_values_from_task(config, task)
TM-->>TE: usage_values (IndexMap)
TE->>T: task.tera_ctx(config)
T-->>TE: tera_ctx (includes vars, env, tools)
TE->>TE: tera_ctx.insert("usage", &usage_values)
TE->>TE: tera_ctx.insert("env", env)
TE->>TR: get_tera(config_root)
TR-->>TE: tera instance
end
loop for each raw_entry in task.run()
alt tera_state is Some AND raw_entry.has_tera_template()
TE->>TR: raw_entry.render(tera, tera_ctx)
TR-->>TE: rendered RunEntry
else
TE->>TE: use raw_entry as-is
end
TE->>TE: match entry { Script | SingleTask | TaskGroup }
end
Reviews (2): Last reviewed commit: "[autofix.ci] apply automated fixes" | Re-trigger Greptile |
### 🚀 Features - **(registry)** add .perl-version support for perl by @ergofriend in [#9102](#9102) - **(task)** add Tera template support for inline table run tasks by @iamkroot in [#9079](#9079) ### 🐛 Bug Fixes - **(env)** use runtime symlink paths for fuzzy versions by @jdx in [#9143](#9143) - **(github)** use full token resolution chain for attestation verification by @jdx in [#9154](#9154) - **(go)** Remove install-time version override for subpath packages by @c22 in [#9135](#9135) - **(npm)** respect install_before when resolving dist-tag versions by @webkaz in [#9145](#9145) - **(self-update)** ensure subcommand exists by @salim-b in [#9144](#9144) - **(task)** show available tasks when run target missing by @jdx in [#9141](#9141) - **(task)** forward task help args and add raw_args by @jdx in [#9118](#9118) - **(task)** remove red/yellow from task prefix colors by @lechuckcaptain in [#8782](#8782) - **(task)** merge TOML task block into same-named file task and surface resolved dir by @jdx in [#9147](#9147) - **(toolset)** round-trip serialized tool options by @atharvasingh7007 in [#9124](#9124) - **(vfox)** fallback to absolute bin path if env_keys not set by @80avin in [#9151](#9151) ### 📚 Documentation - make agent guide wording generic by @jdx in [#9142](#9142) ### 📦️ Dependency Updates - update ghcr.io/jdx/mise:deb docker digest to e019cb9 by @renovate[bot] in [#9160](#9160) - update ghcr.io/jdx/mise:copr docker digest to 8d25608 by @renovate[bot] in [#9159](#9159) - update ghcr.io/jdx/mise:rpm docker digest to 22e52da by @renovate[bot] in [#9161](#9161) - update ghcr.io/jdx/mise:alpine docker digest to a3da97c by @renovate[bot] in [#9158](#9158) - update rust docker digest to 4a2ef38 by @renovate[bot] in [#9162](#9162) - update ubuntu:24.04 docker digest to c4a8d55 by @renovate[bot] in [#9164](#9164) - update rust crate aws-lc-rs to v1.16.3 by @renovate[bot] in [#9165](#9165) - update ubuntu docker tag to resolute-20260413 by @renovate[bot] in [#9169](#9169) - update rust crate clap to v4.6.1 by @renovate[bot] in [#9166](#9166) - update taiki-e/install-action digest to a2352fc by @renovate[bot] in [#9163](#9163) - update rust crate ctor to 0.10 by @renovate[bot] in [#9170](#9170) - update rust crate tokio to v1.52.1 by @renovate[bot] in [#9167](#9167) - update rust crate rmcp-macros to 0.17 by @renovate[bot] in [#9173](#9173) - update rust crate signal-hook to 0.4 by @renovate[bot] in [#9177](#9177) - update rust crate zipsign-api to 0.2 by @renovate[bot] in [#9180](#9180) - update rust crate toml_edit to 0.25 by @renovate[bot] in [#9179](#9179) - update rust crate strum to 0.28 by @renovate[bot] in [#9178](#9178) ### 📦 Registry - add ibmcloud by @dnwe in [#9139](#9139) - add rush by @jdx in [#9146](#9146) ### New Contributors - @80avin made their first contribution in [#9151](#9151) - @atharvasingh7007 made their first contribution in [#9124](#9124) - @lechuckcaptain made their first contribution in [#8782](#8782) - @ergofriend made their first contribution in [#9102](#9102) - @dnwe made their first contribution in [#9139](#9139) ## 📦 Aqua Registry Updates #### New Packages (3) - [`controlplaneio-fluxcd/flux-operator`](https://github.com/controlplaneio-fluxcd/flux-operator) - [`dependency-check/DependencyCheck`](https://github.com/dependency-check/DependencyCheck) - [`kiro.dev/kiro-cli`](https://github.com/kiro.dev/kiro-cli) #### Updated Packages (2) - [`jreleaser/jreleaser/standalone`](https://github.com/jreleaser/jreleaser/standalone) - [`sigstore/cosign`](https://github.com/sigstore/cosign)
Fixes #8761