Encountered a problem during the conversion of Azure DevOps YAML to a PowerShell object. #184
Closed
naitikkumar
started this conversation in
Show and tell
Replies: 2 comments 2 replies
-
Hi, Please include the contents of the docx directly in this issue. Markdown has much better formatting. |
Beta Was this translation helpful? Give feedback.
1 reply
-
I tried this: PS /home/gabriel> $blob = @("apps-conf-feature-3097.zip", "apps-conf-feature3096.zip")
PS /home/gabriel> $firstobject = "apps-conf-feature3096.zip"
PS /home/gabriel> $data = @"
>> ---
>> pool:
>> vmImage: ubuntu-latest
>> parameters:
>> - name: release-version
>> default: ''
>> values:
>> steps:
>> - script: echo Hello, world!
>> displayName: 'Run a one-line script'
>> - script: |
>> echo Add other tasks to build, test, and deploy your project.
>> echo See https://aka.ms/yaml
>> displayName: 'Run a multi-line script'
>> "@
PS /home/gabriel> $newcont1 = ConvertFrom-Yaml -Ordered $data
PS /home/gabriel> foreach ($param in $newcont1.parameters ) {
>> if ($param.name -like "release-version") {
>> $param.values = $blob
>> $param.default = $firstobject
>> }
>> }
PS /home/gabriel> $newcont1 | ConvertTo-Yaml -Options WithIndentedSequences
pool:
vmImage: ubuntu-latest
parameters:
- name: release-version
default: apps-conf-feature3096.zip
values:
- apps-conf-feature-3097.zip
- apps-conf-feature3096.zip
steps:
- script: echo Hello, world!
displayName: Run a one-line script
- script: |
echo Add other tasks to build, test, and deploy your project.
echo See https://aka.ms/yaml
displayName: Run a multi-line script Seems fine. If I'm missing something, let me know. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Source Yaml:
Output:
Observation: Name should be child but values is child
Beta Was this translation helpful? Give feedback.
All reactions