Reputation: 33
I've got the following job:
- job: CB_Jobs
displayName: CB jobs
pool: server
strategy:
matrix:
Libs:
Dir: 'src/hw/libs'
Apps:
Dir: 'src/hw/apps'
steps:
Which is just specifying a list of directories. I need to be able to specify that list in a build variable (which is settable at queue time). This is possible in the non-YAML flow by specifying the job as multi-configuration with the name of the build variable as the Multipliers. How do I do this in YAML?
Upvotes: 1
Views: 2971
Reputation: 71
parameters:
- name: Libs
type: object
default: []
jobs:
- job: CB_Jobs
pool: server
strategy:
matrix:
${{ each Lib in parameters.Libs}}:
${{ Lib }}:
Dir: ${{ Lib }}
You can access the variable Dir using $(Dir) in steps
Upvotes: 0
Reputation: 11
You can assign a JSON formatted string, and it will be parsed by Azure:
Example: (you might need to tweak the syntax)
In a previous job (JobA):
$json="{'job1': {'Work': 'work1'}, 'job2': {'Work': 'work2'}}"
Write-Host "##vso[task.setvariable variable=$jobsToRunInParallel;isOutput=true]$json"
In the job to run in parallel:
matrix: $[ dependencies.JobA.outputs['jobsToRunInParallel'] ]
Upvotes: 1