1

I have this variable

Write-Host "##vso[task.setvariable variable=others_sql_server;]$others_sql_server"

Its value is for example "aaa|bbb|ccc". I would like to use it for looping a task

- ${{ each dbi in split(variables.others_sql_server, '|') }}:
    - task: PowerShell@2
      displayName: "XXXXX"
      inputs:

This does not work. Any solution?

Riccardo

1 Answer 1

3

Nope, for-each loops can only be applied on parameters, not on outputs/variables from previous jobs since those could not be compiled at time of pipeline start.

https://learn.microsoft.com/en-us/azure/devops/pipelines/process/expressions?view=azure-devops#each-keyword

You'll probably need to create a custom script and do a loop in there and apply your logic.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.