Skip to content
Open
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
23 changes: 22 additions & 1 deletion .vsts-dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,23 @@ extends:
suppressionsFile: $(Build.SourcesDirectory)/eng/CredScanSuppressions.json

stages:
# Fail early if not on main or vs* branches
- ${{ if not(or(eq(variables['Build.SourceBranch'], 'refs/heads/main'), startsWith(variables['Build.SourceBranch'], 'refs/heads/vs'))) }}:
- stage: branchValidation
displayName: Branch Validation
jobs:
- job: fail_unsupported_branches
displayName: Fail for unsupported branches
steps:
Comment thread
AR-May marked this conversation as resolved.
- checkout: none
- powershell: |
$branch = "$(Build.SourceBranch)"
Write-Host "##vso[task.logissue type=error]This pipeline only supports main and vs* branches. Use dedicated pipelines for other branch types."
Write-Host "##vso[task.logissue type=error]Current branch: $branch"
Write-Host "##vso[task.complete result=Failed;]Pipeline execution stopped for unsupported branch."
exit 1
displayName: 'Validate branch type'

- ${{ if or(startsWith(variables['Build.SourceBranch'], 'refs/heads/vs'), eq(variables['Build.SourceBranch'], 'refs/heads/main')) }}:
- stage: localization
displayName: Localization
Expand Down Expand Up @@ -122,7 +139,11 @@ extends:

- stage: build
displayName: Build
dependsOn: [] # empty dependency list to enable parallelization with localization stage
${{ if not(or(eq(variables['Build.SourceBranch'], 'refs/heads/main'), startsWith(variables['Build.SourceBranch'], 'refs/heads/vs'))) }}:
dependsOn:
- branchValidation
${{ else }}:
dependsOn: []
jobs:
- template: /azure-pipelines/.vsts-dotnet-build-jobs.yml@self
parameters:
Expand Down
Loading