File tree Expand file tree Collapse file tree 2 files changed +45
-3
lines changed Expand file tree Collapse file tree 2 files changed +45
-3
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,6 @@ function Start-DevOpsBuild {
1313 param (
1414 $Organization = " azure-sdk" ,
1515 $Project = " internal" ,
16- [Parameter (Mandatory = $true )]
1716 $SourceBranch ,
1817 [Parameter (Mandatory = $true )]
1918 $DefinitionId ,
Original file line number Diff line number Diff line change 1+ <#
2+ . SYNOPSIS
3+ Queues an Azure DevOps Pipeline run optionally canceling similar runs
4+
5+ . PARAMETER Organization
6+ Azure DevOps organization name
7+
8+ . PARAMETER Project
9+ Azure DevOps project name
10+
11+ . PARAMETER SourceBranch
12+ Source branch use when executing the DevOps pipeline. Specifying an empty string
13+ will result in queuing of the run with the default branch configured for the
14+ pipeline.
15+
16+ . PARAMETER DefinitionId
17+ Pipline definition ID
18+
19+ . PARAMETER CancelPreviousBuilds
20+ Requires a value for SourceBranch. Cancel previous builds before queuing the new
21+ build.
22+
23+ . PARAMETER VsoQueuedPipelines
24+ Variable name to set in DevOps for the queued pipeline links
25+
26+ . PARAMETER Base64EncodedAuthToken
27+ Auth token for Azure DevOps API
28+
29+ . PARAMETER BuildParametersJson
30+ Additional build parameters to provide to the pipeline execution.
31+
32+ Of the format:
33+
34+ ```json
35+ {
36+ "variable1": "value1",
37+ "variable2": "value2"
38+ }
39+ ```
40+
41+ #>
42+
143[CmdletBinding (SupportsShouldProcess = $true )]
244param (
345 [Parameter (Mandatory = $true )]
648 [Parameter (Mandatory = $true )]
749 [string ]$Project ,
850
9- [Parameter (Mandatory = $true )]
1051 [string ]$SourceBranch ,
1152
1253 [Parameter (Mandatory = $true )]
2667
2768. (Join-Path $PSScriptRoot common.ps1)
2869
29- if ($CancelPreviousBuilds )
70+ # Skip if SourceBranch is empty because it we cannot generate a target branch
71+ # name from an empty string.
72+ if ($CancelPreviousBuilds -and $SourceBranch )
3073{
3174 try {
3275 $queuedBuilds = Get-DevOpsBuilds - BranchName " refs/heads/$SourceBranch " - Definitions $DefinitionId `
You can’t perform that action at this time.
0 commit comments