Reputation: 683
I have a Task Group that I created out of a set of build tasks. I am able to edit the tasks quite well, but i now realise i will need to add another parameter to the task group. How do I go about doing that?
Upvotes: 30
Views: 16954
Reputation: 595
In you have a powershell script inside your task group. The way to trigger a parameter in your task group is to define in your powerwhell script a variable that is declared with parenthesis '()' and not curly parenthesis '{}'.
For example:
$(Parameters.pipeline)
i.e. if you use $(Parameters.pipeline) then you will force a Parameter Parameters.pipeline for your task group
Once you have done this, then you can use in your task group the parameters as follows
For example you can create new parameters in your pipeline when you link one of the properties of other task.
See next picture
You can see the linked parameters here
I see this useful to synchronize the values between tasks when you do not have the option to use a variable.
In other cases, i would just use a variable directly.
With variables is easier, you use define then in your pipeline and then you can use them all over the tasks if you do ${env:mydefinedvariable} or just e.g. $env:pipelineNameParameter
Upvotes: 0
Reputation: 691
In addition to the accepted answer, if you want to add parameters that are not directly referenced by tasks within the tasks group (e.g. to use in a config file token replacement task) then you can export your task group, edit the .json file then import it back in. The parameters are in an inputs array near the end of file. You can also hide parameters here if you only want to use them internally to the task group by setting a default value and adding a 'visibleRule' property, see this article for details: https://medium.com/objectsharp/how-to-hide-a-task-group-parameter-b95f7c85870c
This will create a new task group rather than updating your current task group. If you want to update the task group, you can use this REST API: https://learn.microsoft.com/en-us/rest/api/azure/devops/distributedtask/taskgroups/update?view=azure-devops-rest-5.1
Upvotes: 3
Reputation: 59055
Task group parameters are automatically created based on the variables used in the tasks. If you reference a new variable in a task that's within a task group, it will pop up.
Upvotes: 52