Skip to content
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
18 changes: 18 additions & 0 deletions Steps/ApplyAdoBranchNameWorkaround.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
## @file
# Azure Pipelines step template to apply a workaround for branch names
# on Azure DevOps (ADO).
#
# Copyright (c) Microsoft Corporation. All rights reserved.
# SPDX-License-Identifier: BSD-2-Clause-Patent
##

steps:

# $System.PullRequest.targetBranch looks like "dev/whatever" on GitHub,
# but looks like "refs/heads/dev/whatever" on DevOps. The DevOps version
# can't be used for comparison for the PR Eval.
- powershell:
$TargetBranch = "$(System.PullRequest.targetBranch)".replace('refs/heads/', '');
Write-Host "##vso[task.setvariable variable=pr_compare_branch]origin/$TargetBranch";
displayName: Apply Branch Name Workaround
condition: condition: and(eq(variables['Build.Reason'], 'PullRequest'), contains(variables['System.PullRequest.TargetBranch'], 'refs/heads/'))
2 changes: 2 additions & 0 deletions Steps/BuildPlatform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ steps:
# Set default
- bash: echo "##vso[task.setvariable variable=pkg_count]${{ 1 }}"

- template: ApplyAdoBranchNameWorkaround.yml

# trim the package list if this is a PR
- task: CmdLine@1
displayName: Check if ${{ parameters.build_pkg }} Needs Testing
Expand Down
9 changes: 1 addition & 8 deletions Steps/PrGate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,7 @@ steps:
echo "##vso[task.setvariable variable=pkgs_to_build]${{ parameters.build_pkgs }}"
echo "##vso[task.setvariable variable=pkg_count]${{ 1 }}"

# $System.PullRequest.targetBranch looks like "dev/whatever" on GitHub,
# but looks like "refs/heads/dev/whatever" on DevOps. The DevOps version
# can't be used for comparison for the PR Eval.
- powershell:
$TargetBranch = "$(System.PullRequest.targetBranch)".replace('refs/heads/', '');
Write-Host "##vso[task.setvariable variable=pr_compare_branch]origin/$TargetBranch";
displayName: Apply Branch Name Workaround
condition: and(eq(variables['Build.Reason'], 'PullRequest'), contains(variables['System.PullRequest.TargetBranch'], 'refs/heads/'))
- template: ApplyAdoBranchNameWorkaround.yml

# Trim the package list if this is a PR
- ${{ if eq(parameters.do_pr_eval, true) }}:
Expand Down