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
@@ -38,14 +38,14 @@ When using `target: 1es`, the pipeline will extend `1es/1ES.Unofficial.PipelineT
38
38
### `job`
39
39
40
40
Generates a **job-level ADO YAML template** with `jobs:` at root. This is a
41
-
reusable template that can be included in an existing pipeline -- it does not
41
+
reusable template that can be included in an existing pipeline — it does not
42
42
generate a complete pipeline.
43
43
44
-
The output contains the same 3-job chain (Agent -> Detection -> SafeOutputs) as
44
+
The output contains the same 3-job chain (Agent → Detection → SafeOutputs) as
45
45
`standalone`, with:
46
46
- Job names prefixed with the agent name for uniqueness (e.g., `DailyReview_Agent`)
47
47
- No triggers, pipeline name, or resource declarations (the parent pipeline owns those)
48
-
- Pool baked in from the front matter `pool:` field
48
+
- Pool baked in from the front matter `pool:` field (`vmImage` or `name`; defaults to `vmImage: ubuntu-22.04`)
49
49
50
50
Example front matter:
51
51
```yaml
@@ -59,6 +59,9 @@ jobs:
59
59
- job: Build
60
60
steps: ...
61
61
- template: agents/review.lock.yml
62
+
parameters:
63
+
dependsOn: [Build] # list of upstream job names; omit for implicit dep on previous job
64
+
condition: succeeded('Build') # optional; ANDed into the agent job's internal condition
62
65
```
63
66
64
67
#### Usage inside a user-defined stage
@@ -73,6 +76,12 @@ stages:
73
76
- template: agents/review.lock.yml
74
77
```
75
78
79
+
#### Notes
80
+
81
+
- ADO's [`jobs.template`](https://learn.microsoft.com/azure/devops/pipelines/yaml-schema/jobs-template) schema only allows `template:` and `parameters:` at the call site. `dependsOn:` and `condition:` as bare keys on the `- template:` line are rejected; the compiled template surfaces them as parameters and applies them to the agent job internally.
82
+
- When the agent has a Setup job (e.g. PR or pipeline filters), the `dependsOn` parameter **must** be a YAML list — the template uses `${{ each }}` to merge `Setup` with the caller's deps, and `${{ each }}` requires an iterable. For agents without a Setup job, either a string or a list works.
83
+
- The `condition` parameter is ANDed into the agent job's existing internal condition. Omit it to preserve ADO's native `succeeded()` behaviour.
84
+
76
85
### `stage`
77
86
78
87
Generates a **stage-level ADO YAML template** with `stages:` at root. This
@@ -91,12 +100,16 @@ stages:
91
100
- stage: Build
92
101
jobs: ...
93
102
- template: agents/review.lock.yml
94
-
dependsOn: Build
95
-
condition: succeeded()
103
+
parameters:
104
+
dependsOn: Build # or [Build, Test]; omit for implicit dep on previous stage
105
+
condition: succeeded('Build') # optional; omit for ADO's default succeeded()
96
106
```
97
107
98
-
ADO natively supports `dependsOn` and `condition` at the template call site --
99
-
no template parameters are needed for stage ordering.
108
+
#### Notes
109
+
110
+
- ADO's [`stages.template`](https://learn.microsoft.com/azure/devops/pipelines/yaml-schema/stages-template) schema only allows `template:` and `parameters:` at the call site. `dependsOn:` and `condition:` as bare top-level keys on the `- template:` line are **rejected** by the YAML parser. The compiled template surfaces them as parameters and applies them to the inner stage block.
111
+
- The `dependsOn` parameter accepts a single string or a list (matching ADO's native `dependsOn:` semantics).
112
+
- Same 3-job chain, job-name prefixing, and pool handling as `target: job`.
100
113
101
114
---
102
115
@@ -109,3 +122,7 @@ If your agent declares additional repositories via `repos:`, you must manually a
109
122
</Aside>
110
123
111
124
Both `job` and `stage` targets produce templates with the same 3-job execution chain (Agent → Detection → SafeOutputs), job-name prefixing for uniqueness, and pool configuration baked in from the `pool:` front-matter field. The difference is only in the YAML wrapper: `jobs:`at root vs. `stages:` at root.
125
+
126
+
<Aside type="caution" title="dependsOn and condition must be parameters">
127
+
ADO's template call-site schema only allows `template:` and `parameters:` as top-level keys on a `- template:` entry. Bare `dependsOn:` and `condition:` keys on the `- template:` line are rejected by ADO. Always pass them through `parameters:` as shown in the usage examples above.
0 commit comments