Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync eng/common directory with azure-sdk-tools for PR 1852 #15195

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion eng/common/scripts/Invoke-DevOpsAPI.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ function Start-DevOpsBuild {
param (
$Organization="azure-sdk",
$Project="internal",
[Parameter(Mandatory = $true)]
$SourceBranch,
[Parameter(Mandatory = $true)]
$DefinitionId,
Expand Down
47 changes: 45 additions & 2 deletions eng/common/scripts/Queue-Pipeline.ps1
Original file line number Diff line number Diff line change
@@ -1,3 +1,45 @@
<#
.SYNOPSIS
Queues an Azure DevOps Pipeline run optionally canceling similar runs

.PARAMETER Organization
Azure DevOps organization name

.PARAMETER Project
Azure DevOps project name

.PARAMETER SourceBranch
Source branch use when executing the DevOps pipeline. Specifying an empty string
will result in queuing of the run with the default branch configured for the
pipeline.

.PARAMETER DefinitionId
Pipline definition ID

.PARAMETER CancelPreviousBuilds
Requires a value for SourceBranch. Cancel previous builds before queuing the new
build.

.PARAMETER VsoQueuedPipelines
Variable name to set in DevOps for the queued pipeline links

.PARAMETER Base64EncodedAuthToken
Auth token for Azure DevOps API

.PARAMETER BuildParametersJson
Additional build parameters to provide to the pipeline execution.

Of the format:

```json
{
"variable1": "value1",
"variable2": "value2"
}
```

#>

[CmdletBinding(SupportsShouldProcess = $true)]
param(
[Parameter(Mandatory = $true)]
Expand All @@ -6,7 +48,6 @@ param(
[Parameter(Mandatory = $true)]
[string]$Project,

[Parameter(Mandatory = $true)]
[string]$SourceBranch,

[Parameter(Mandatory = $true)]
Expand All @@ -26,7 +67,9 @@ param(

. (Join-Path $PSScriptRoot common.ps1)

if ($CancelPreviousBuilds)
# Skip if SourceBranch is empty because it we cannot generate a target branch
# name from an empty string.
if ($CancelPreviousBuilds -and $SourceBranch)
{
try {
$queuedBuilds = Get-DevOpsBuilds -BranchName "refs/heads/$SourceBranch" -Definitions $DefinitionId `
Expand Down