You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs(site): document typed task helpers in ir.mdx and extending.mdx (#1069)
- Add tasks.rs to the Module Layout section in ir.mdx
- Add new 'Typed task helpers' section to ir.mdx documenting all 9
factory functions (CopyFiles@2, DockerInstaller@0, DotNetCoreCLI@2,
ArchiveFiles@2, ExtractFiles@1, PublishTestResults@2, NuGetCommand@2,
PowerShell@2 file+inline modes), including required-param table,
usage examples, and contributor guidance for adding new helpers
- Update 'Task steps' section in extending.mdx to surface the typed
helpers as the preferred pattern over raw TaskStep::new() calls,
with cross-link to the ir.mdx reference
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The full set of typed helpers lives in `src/compile/ir/tasks.rs` and is documented in the [IR reference](/ado-aw/reference/ir/#typed-task-helpers). Helpers cover: `CopyFiles@2`, `DockerInstaller@0`, `DotNetCoreCLI@2`, `ArchiveFiles@2`, `ExtractFiles@1`, `PublishTestResults@2`, `NuGetCommand@2`, and `PowerShell@2` (file and inline modes).
141
+
142
+
When no typed helper exists for your task, fall back to `TaskStep::new`:
-`stage.rs` — `Stage` plus target-stage external `dependsOn` / `condition` wrapping.
27
28
-`env.rs` — typed environment values (`EnvValue`) including ADO macros, pipeline variables, secrets, `OutputRef`s, `Coalesce`, and macro-form `Concat`.
@@ -114,6 +115,69 @@ let synth = Step::Bash(
114
115
);
115
116
```
116
117
118
+
## Typed task helpers
119
+
120
+
`src/compile/ir/tasks.rs` contains typed factory functions for common ADO built-in tasks. Each function returns a pre-configured `TaskStep` with required inputs already set; optional inputs are layered on with `.with_input("key", "value")` chaining.
121
+
122
+
These helpers eliminate hand-crafted `TaskStep::new(…)` + raw string inputs at every call site, making task usage self-documenting and the required/optional input boundary explicit.
// Publish test results (required inputs set; no optional inputs needed)
158
+
letpublish=Step::Task(
159
+
publish_test_results_step("VSTest", "**/*.trx")
160
+
.with_input("failTaskOnFailedTests", "true"),
161
+
);
162
+
163
+
// Inline PowerShell (cross-platform)
164
+
letps=Step::Task(
165
+
powershell_inline_step("Write-Output 'hello'")
166
+
.with_input("pwsh", "true"),
167
+
);
168
+
```
169
+
170
+
### Adding a new helper
171
+
172
+
When you need an ADO task that doesn't have a typed helper yet, add one to `tasks.rs`:
173
+
174
+
1. Write a `pub fn <name>_step(…) -> TaskStep` that sets the ADO task identifier and all **required** inputs as positional parameters.
175
+
2. Document required vs. optional inputs with the `/// | Input key | Type | Default | Description |` table pattern used by existing helpers.
176
+
3. Add a link to the ADO task reference at `learn.microsoft.com`.
177
+
4. Write a unit test that asserts the task name, display name, and that required inputs are set with the correct keys.
178
+
179
+
Do **not** use `Step::RawYaml` for tasks that the IR can model. Typed helpers preserve all compiler-owned fields (`condition`, `env`, `timeout`, `continue_on_error`) and participate correctly in the graph pass.
180
+
117
181
## Output declarations and references
118
182
119
183
A producer declares a step output with `OutputDecl`:
0 commit comments