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
Copy file name to clipboardExpand all lines: docs/pipelines/process/template-expressions.md
+9-4Lines changed: 9 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -78,17 +78,22 @@ You can use [general functions](expressions.md#functions) in your templates. You
78
78
79
79
```yaml
80
80
parameters:
81
-
- name: 'restoreProjects'
82
-
default: ''
81
+
- name: 'customVersion'
83
82
type: string
84
-
- name: 'buildProjects'
85
83
default: ''
84
+
- name: 'defaultVersion'
86
85
type: string
86
+
default: '1.0.0'
87
87
88
88
steps:
89
-
- script: echo ${{ coalesce(parameters.foo, parameters.bar, 'Nothing to see') }}
89
+
- script: echo Version is ${{ coalesce(parameters.customVersion, parameters.defaultVersion) }}
90
90
```
91
91
92
+
> [!NOTE]
93
+
> String parameters with `default: ''` (empty string) behave differently depending on how you trigger the pipeline:
94
+
> * **In the pipeline editor**: You can run the pipeline directly and the empty string default is respected, allowing `coalesce` to fall back to the next value.
95
+
> * **In the Run Pipeline pane**: Azure DevOps requires you to provide a non-empty value for parameters with empty string defaults, preventing `coalesce` from falling back.
96
+
92
97
### Insertion
93
98
94
99
You can use template expressions to alter the structure of a YAML pipeline.
0 commit comments