...

Text file src/github.com/Azure/azure-sdk-for-go/eng/common/scripts/job-matrix/Create-JobMatrix.ps1

Documentation: github.com/Azure/azure-sdk-for-go/eng/common/scripts/job-matrix

     1<#
     2    .SYNOPSIS
     3        Generates a JSON object representing an Azure Pipelines Job Matrix.
     4        See https://docs.microsoft.com/en-us/azure/devops/pipelines/process/phases?view=azure-devops&tabs=yaml#parallelexec
     5
     6    .EXAMPLE
     7    ./eng/common/scripts/Create-JobMatrix $context
     8#>
     9
    10[CmdletBinding()]
    11param (
    12    [Parameter(Mandatory=$True)][string] $ConfigPath,
    13    [Parameter(Mandatory=$True)][string] $Selection,
    14    [Parameter(Mandatory=$False)][string] $DisplayNameFilter,
    15    [Parameter(Mandatory=$False)][array] $Filters,
    16    [Parameter(Mandatory=$False)][array] $Replace,
    17    [Parameter(Mandatory=$False)][array] $NonSparseParameters
    18)
    19
    20. $PSScriptRoot/job-matrix-functions.ps1
    21
    22if (!(Test-Path $ConfigPath)) {
    23    Write-Error "ConfigPath '$ConfigPath' does not exist."
    24    exit 1
    25}
    26$config = GetMatrixConfigFromJson (Get-Content $ConfigPath)
    27# Strip empty string filters in order to be able to use azure pipelines yaml join()
    28$Filters = $Filters | Where-Object { $_ }
    29
    30[array]$matrix = GenerateMatrix `
    31    -config $config `
    32    -selectFromMatrixType $Selection `
    33    -displayNameFilter $DisplayNameFilter `
    34    -filters $Filters `
    35    -replace $Replace `
    36    -nonSparseParameters $NonSparseParameters
    37
    38$serialized = SerializePipelineMatrix $matrix
    39
    40Write-Output $serialized.pretty
    41Write-Output "##vso[task.setVariable variable=matrix;isOutput=true]$($serialized.compressed)"

View as plain text