Closed gherasim-learn closed 1 year ago
Hi @gherasim-learn
I've never used objects as inputs, so this was new to me. I've recreated a similar pipeline and tried to trigger it manually, specifying a custom input from the user.
trigger: none
pool:
vmImage: ubuntu-latest
parameters:
- name: databases
type: object
displayName: Databases
default:
- first_database
- second_database
- third_database
steps:
- ${{ each database in parameters.databases }}:
- script: echo ${{database}}
displayName: 'Run a one-line script'
This is what is sent from Azure to the backend:
So I think you need a newline in the template parameter to work.
I tried to trigger it like this:
templateParameters: 'databases: "- custom 1\n- Custom2"'
But I got the same error as you did...
So far I'm not sure yet how this would work (if at all) - I'll keep you up to date when I find something out
Hi huserben
I tried with new line too. I also tried with and without double quotes "", and also with curly brackets {}, but without success.
UPDATE:
I tried with
templateParameters: 'databases: [custom, Custom2]'
and worked. I can't believe it. :D
It will be nice if you can add this in the documentation.
@gherasim-learn amazing, thanks for investigating and sharing here.
I've just updated the docs to include the following section:
Thanks for contributing to the task, I really appreciate the time you took to figuring this out.
Do you see anything pending or potential improvements for the docs? If not I'd propose that we can close this issue.
Hi, sorry for the late answer.
You can close the issue, the docs looks good to me.
Thank you!
Hello!
I have a pipeline with a parameter of type object so I can define an array to loop through:![image](https://user-images.githubusercontent.com/75733876/201304849-13abd9ff-b7f5-43f4-9f73-b477f2da5dc2.png)
I have a second pipeline that triggers the first pipeline. The issue is that I can't set a value for the template parameter databases:
The second pipeline fail with the following error
![image](https://user-images.githubusercontent.com/75733876/201296572-6e8ef88b-e8c8-43f9-9e25-75063fa7b813.png)