diff --git a/build/AzurePipelinesTemplates/WindowsAppSDK-Build-Stage.yml b/build/AzurePipelinesTemplates/WindowsAppSDK-Build-Stage.yml index 0d8b0a7ffb..20d5f91568 100644 --- a/build/AzurePipelinesTemplates/WindowsAppSDK-Build-Stage.yml +++ b/build/AzurePipelinesTemplates/WindowsAppSDK-Build-Stage.yml @@ -57,16 +57,52 @@ stages: buildConfiguration: 'release' normalizedConfiguration: 'fre' variables: - ob_outputDirectory: '$(REPOROOT)\out' - ob_sdl_codeSignValidation_excludes: '-|**\Release\**;-|**\packages\**' - ob_artifactBaseName: "FoundationBinaries_$(buildConfiguration)_$(buildPlatform)" - ${{ if parameters.runStaticAnalysis }}: - ob_sdl_apiscan_enabled: true - ${{ if not( parameters.runStaticAnalysis ) }}: - ob_sdl_apiscan_enabled: false - ob_sdl_apiscan_softwareFolder: '$(build.SourcesDirectory)\APIScanTarget' - ob_sdl_apiscan_symbolsFolder: '$(build.SourcesDirectory)\APIScanTarget;SRV*https://symweb.azurefd.net' + - name: ob_outputDirectory + value: '$(REPOROOT)\out' + - name: ob_sdl_codeSignValidation_excludes + value: '-|**\Release\**;-|**\packages\**' + - name: ob_artifactBaseName + value: "FoundationBinaries_$(buildConfiguration)_$(buildPlatform)" + - name: ob_sdl_apiscan_enabled + ${{ if parameters.runStaticAnalysis }}: + value: true + ${{ else }}: + value: false + - name: ob_sdl_apiscan_softwareFolder + value: '$(build.SourcesDirectory)\APIScanTarget' + - name: ob_sdl_apiscan_symbolsFolder + value: '$(build.SourcesDirectory)\APIScanTarget;SRV*https://symweb.azurefd.net' + - ${{ if contains(variables['Build.SourceBranch'], 'user') }}: + # If this pipeline run is targetting a developer's private branch, most of the time there is no + # corresponding private branch on the Agg repo. Therefore, by default, map to the Main branch on + # the Agg repo to avoid a "file not found" error. + # In the uncommon case that the developer means to target the corresponding private branch on the + # Agg repo, change WindowsAppSDKAggregatorMainBranch to WindowsAppSDKAggregatorSourceBranch below. + - template: build/AzurePipelinesTemplates/WindowsAppSDK-Global-LKGVersions.yml@WindowsAppSDKAggregatorMainBranch + - ${{ elseif and(startsWith(variables['Build.SourceBranch'], 'refs/heads/release'), not(startsWith(variables['Build.SourceBranch'], 'refs/heads/release-1.7'))) }}: + # If this pipeline run is targetting a servicing branch which is new enough (1.8+), then we expect + # the file WindowsAppSDK-Global-LKGVersions.yml to exists on the Agg repo in the corresponding + # branch, so target the corresponding branch on the Agg repo. + - template: build/AzurePipelinesTemplates/WindowsAppSDK-Global-LKGVersions.yml@WindowsAppSDKAggregatorSourceBranch + - ${{ else }}: + # If this pipeline run is targetting the Main branch, a Pull Request branch (e.g., refs/pull/12460423/merge), + # or some other unexpected branch, target the Main branch on the Agg repo by default. + - template: build/AzurePipelinesTemplates/WindowsAppSDK-Global-LKGVersions.yml@WindowsAppSDKAggregatorMainBranch + - name: localCompilerOverridePackageName + value: $[coalesce(variables.compilerOverridePackageName, variables.global_CompilerOverridePackageName)] + - name: localCompilerOverridePackageVersion + value: $[coalesce(variables.compilerOverridePackageVersion, variables.global_CompilerOverridePackageVersion)] steps: + # In case we picked the wrong branch for the Agg repo in the variables section above, this helps diagnose that problem. + - script: | + echo Build.SourceBranch=$(Build.SourceBranch) + echo compilerOverridePackageName=$(compilerOverridePackageName) + echo compilerOverridePackageVersion=$(compilerOverridePackageVersion) + echo global_CompilerOverridePackageName=$(global_CompilerOverridePackageName) + echo global_CompilerOverridePackageVersion=$(global_CompilerOverridePackageVersion) + echo localCompilerOverridePackageName=$(localCompilerOverridePackageName) + echo localCompilerOverridePackageVersion=$(localCompilerOverridePackageVersion) + - template: WindowsAppSDK-BuildFoundation-Steps.yml@self parameters: SignOutput: ${{ parameters.SignOutput }} @@ -128,17 +164,54 @@ stages: buildConfiguration: 'Release' normalizedConfiguration: 'fre' variables: - ob_outputDirectory: '$(REPOROOT)\out' - ob_sdl_codeSignValidation_excludes: '-|**\Release\**' - ob_sdl_suppression_suppressionSet: default - ob_artifactBaseName: "MrtBinaries_$(buildConfiguration)_$(buildPlatform)" - ${{ if parameters.runStaticAnalysis }}: - ob_sdl_apiscan_enabled: true - ${{ if not( parameters.runStaticAnalysis ) }}: - ob_sdl_apiscan_enabled: false - ob_sdl_apiscan_softwareFolder: '$(build.SourcesDirectory)\APIScanTarget' - ob_sdl_apiscan_symbolsFolder: '$(build.SourcesDirectory)\APIScanTarget;SRV*https://symweb.azurefd.net' + - name: ob_outputDirectory + value: '$(REPOROOT)\out' + - name: ob_sdl_codeSignValidation_excludes + value: '-|**\Release\**' + - name: ob_sdl_suppression_suppressionSet + value: default + - name: ob_artifactBaseName + value: "MrtBinaries_$(buildConfiguration)_$(buildPlatform)" + - name: ob_sdl_apiscan_enabled + ${{ if parameters.runStaticAnalysis }}: + value: true + ${{ else }}: + value: false + - name: ob_sdl_apiscan_softwareFolder + value: '$(build.SourcesDirectory)\APIScanTarget' + - name: ob_sdl_apiscan_symbolsFolder + value: '$(build.SourcesDirectory)\APIScanTarget;SRV*https://symweb.azurefd.net' + - ${{ if contains(variables['Build.SourceBranch'], 'user') }}: + # If this pipeline run is targetting a developer's private branch, most of the time there is no + # corresponding private branch on the Agg repo. Therefore, by default, map to the Main branch on + # the Agg repo to avoid a "file not found" error. + # In the uncommon case that the developer means to target the corresponding private branch on the + # Agg repo, change WindowsAppSDKAggregatorMainBranch to WindowsAppSDKAggregatorSourceBranch below. + - template: build/AzurePipelinesTemplates/WindowsAppSDK-Global-LKGVersions.yml@WindowsAppSDKAggregatorMainBranch + - ${{ elseif and(startsWith(variables['Build.SourceBranch'], 'refs/heads/release'), not(or(startsWith(variables['Build.SourceBranch'], 'refs/heads/release-1.0'), startsWith(variables['Build.SourceBranch'], 'refs/heads/release-1.1'), startsWith(variables['Build.SourceBranch'], 'refs/heads/release-1.2'), startsWith(variables['Build.SourceBranch'], 'refs/heads/release-1.3'), startsWith(variables['Build.SourceBranch'], 'refs/heads/release-1.4'), startsWith(variables['Build.SourceBranch'], 'refs/heads/release-1.5'), startsWith(variables['Build.SourceBranch'], 'refs/heads/release-1.6'), startsWith(variables['Build.SourceBranch'], 'refs/heads/release-1.7')))) }}: + # If this pipeline run is targetting a servicing branch which is new enough (1.8+), then we expect + # the file WindowsAppSDK-Global-LKGVersions.yml to exists on the Agg repo in the corresponding + # branch, so target the corresponding branch on the Agg repo. + - template: build/AzurePipelinesTemplates/WindowsAppSDK-Global-LKGVersions.yml@WindowsAppSDKAggregatorSourceBranch + - ${{ else }}: + # If this pipeline run is targetting the Main branch, a Pull Request branch (e.g., refs/pull/12460423/merge), + # or some other unexpected branch, target the Main branch on the Agg repo by default. + - template: build/AzurePipelinesTemplates/WindowsAppSDK-Global-LKGVersions.yml@WindowsAppSDKAggregatorMainBranch + - name: localCompilerOverridePackageName + value: $[coalesce(variables.compilerOverridePackageName, variables.global_CompilerOverridePackageName)] + - name: localCompilerOverridePackageVersion + value: $[coalesce(variables.compilerOverridePackageVersion, variables.global_CompilerOverridePackageVersion)] steps: + # In case we picked the wrong branch for the Agg repo in the variables section above, this helps diagnose that problem. + - script: | + echo Build.SourceBranch=$(Build.SourceBranch) + echo compilerOverridePackageName=$(compilerOverridePackageName) + echo compilerOverridePackageVersion=$(compilerOverridePackageVersion) + echo global_CompilerOverridePackageName=$(global_CompilerOverridePackageName) + echo global_CompilerOverridePackageVersion=$(global_CompilerOverridePackageVersion) + echo localCompilerOverridePackageName=$(localCompilerOverridePackageName) + echo localCompilerOverridePackageVersion=$(localCompilerOverridePackageVersion) + - template: WindowsAppSDK-BuildMRT-Steps.yml@self parameters: SignOutput: ${{ parameters.SignOutput }} diff --git a/build/AzurePipelinesTemplates/WindowsAppSDK-BuildFoundation-Steps.yml b/build/AzurePipelinesTemplates/WindowsAppSDK-BuildFoundation-Steps.yml index db2cbecc5b..cb31691735 100644 --- a/build/AzurePipelinesTemplates/WindowsAppSDK-BuildFoundation-Steps.yml +++ b/build/AzurePipelinesTemplates/WindowsAppSDK-BuildFoundation-Steps.yml @@ -58,8 +58,8 @@ steps: displayName: 'Setup native compiler version override' inputs: microsoftDropReadPat: $(System.AccessToken) - compilerPackageName: $(compilerOverridePackageName) - compilerPackageVersion: $(compilerOverridePackageVersion) + compilerPackageName: $(localCompilerOverridePackageName) + compilerPackageVersion: $(localCompilerOverridePackageVersion) slnDirectory: $(Build.SourcesDirectory) includeUCRT: true ucrtFeedPat: $(System.AccessToken) diff --git a/build/AzurePipelinesTemplates/WindowsAppSDK-BuildInstaller-Stage.yml b/build/AzurePipelinesTemplates/WindowsAppSDK-BuildInstaller-Stage.yml index 18aa9bfe85..163c1b6278 100644 --- a/build/AzurePipelinesTemplates/WindowsAppSDK-BuildInstaller-Stage.yml +++ b/build/AzurePipelinesTemplates/WindowsAppSDK-BuildInstaller-Stage.yml @@ -23,12 +23,46 @@ stages: buildPlatform: 'arm64' buildConfiguration: 'Release' variables: - ob_outputDirectory: '$(REPOROOT)\out' - ob_artifactSuffix: '_$(buildConfiguration)_$(buildPlatform)' - ob_artifactBaseName: "Installer$(ob_artifactSuffix)" + - name: ob_outputDirectory + value: '$(REPOROOT)\out' + - name: ob_artifactSuffix + value: '_$(buildConfiguration)_$(buildPlatform)' + - name: ob_artifactBaseName + value: "Installer$(ob_artifactSuffix)" # foundationRepoPath should be empty because we are not doing multiple checkouts hence # it is not under $(Build.SourcesDirectory)\WindowsAppSDK - foundationRepoPath: "" + - name: foundationRepoPath + value: "" + - ${{ if contains(variables['Build.SourceBranch'], 'user') }}: + # If this pipeline run is targetting a developer's private branch, most of the time there is no + # corresponding private branch on the Agg repo. Therefore, by default, map to the Main branch on + # the Agg repo to avoid a "file not found" error. + # In the uncommon case that the developer means to target the corresponding private branch on the + # Agg repo, change WindowsAppSDKAggregatorMainBranch to WindowsAppSDKAggregatorSourceBranch below. + - template: build/AzurePipelinesTemplates/WindowsAppSDK-Global-LKGVersions.yml@WindowsAppSDKAggregatorMainBranch + - ${{ elseif and(startsWith(variables['Build.SourceBranch'], 'refs/heads/release'), not(startsWith(variables['Build.SourceBranch'], 'refs/heads/release-1.7'))) }}: + # If this pipeline run is targetting a servicing branch which is new enough (1.8+), then we expect + # the file WindowsAppSDK-Global-LKGVersions.yml to exists on the Agg repo in the corresponding + # branch, so target the corresponding branch on the Agg repo. + - template: build/AzurePipelinesTemplates/WindowsAppSDK-Global-LKGVersions.yml@WindowsAppSDKAggregatorSourceBranch + - ${{ else }}: + # If this pipeline run is targetting the Main branch, a Pull Request branch (e.g., refs/pull/12460423/merge), + # or some other unexpected branch, target the Main branch on the Agg repo by default. + - template: build/AzurePipelinesTemplates/WindowsAppSDK-Global-LKGVersions.yml@WindowsAppSDKAggregatorMainBranch + - name: localCompilerOverridePackageName + value: $[coalesce(variables.compilerOverridePackageName, variables.global_CompilerOverridePackageName)] + - name: localCompilerOverridePackageVersion + value: $[coalesce(variables.compilerOverridePackageVersion, variables.global_CompilerOverridePackageVersion)] condition: ne(variables.LatestOfficialBuildID, '') steps: + # In case we picked the wrong branch for the Agg repo in the variables section above, this helps diagnose that problem. + - script: | + echo Build.SourceBranch=$(Build.SourceBranch) + echo compilerOverridePackageName=$(compilerOverridePackageName) + echo compilerOverridePackageVersion=$(compilerOverridePackageVersion) + echo global_CompilerOverridePackageName=$(global_CompilerOverridePackageName) + echo global_CompilerOverridePackageVersion=$(global_CompilerOverridePackageVersion) + echo localCompilerOverridePackageName=$(localCompilerOverridePackageName) + echo localCompilerOverridePackageVersion=$(localCompilerOverridePackageVersion) + - template: WindowsAppSDK-BuildInstaller-Steps.yml@self diff --git a/build/AzurePipelinesTemplates/WindowsAppSDK-BuildInstaller-Steps.yml b/build/AzurePipelinesTemplates/WindowsAppSDK-BuildInstaller-Steps.yml index 8402b53796..2439dc443b 100644 --- a/build/AzurePipelinesTemplates/WindowsAppSDK-BuildInstaller-Steps.yml +++ b/build/AzurePipelinesTemplates/WindowsAppSDK-BuildInstaller-Steps.yml @@ -199,8 +199,8 @@ steps: displayName: 'Setup native compiler version override' inputs: microsoftDropReadPat: $(System.AccessToken) - compilerPackageName: $(compilerOverridePackageName) - compilerPackageVersion: $(compilerOverridePackageVersion) + compilerPackageName: $(localCompilerOverridePackageName) + compilerPackageVersion: $(localCompilerOverridePackageVersion) slnDirectory: $(Build.SourcesDirectory)\$(foundationRepoPath)installer\dev includeUCRT: true ucrtFeedPat: $(System.AccessToken) diff --git a/build/AzurePipelinesTemplates/WindowsAppSDK-BuildMRT-Steps.yml b/build/AzurePipelinesTemplates/WindowsAppSDK-BuildMRT-Steps.yml index cfff8928ce..ee6e6cb978 100644 --- a/build/AzurePipelinesTemplates/WindowsAppSDK-BuildMRT-Steps.yml +++ b/build/AzurePipelinesTemplates/WindowsAppSDK-BuildMRT-Steps.yml @@ -18,8 +18,8 @@ steps: displayName: 'Setup native compiler version override' inputs: microsoftDropReadPat: $(System.AccessToken) - compilerPackageName: $(compilerOverridePackageName) - compilerPackageVersion: $(compilerOverridePackageVersion) + compilerPackageName: $(localCompilerOverridePackageName) + compilerPackageVersion: $(localCompilerOverridePackageVersion) slnDirectory: $(Build.SourcesDirectory)\dev\MRTCore\mrt includeUCRT: true ucrtFeedPat: $(System.AccessToken) diff --git a/build/ProjectReunion-BuildFoundation.yml b/build/ProjectReunion-BuildFoundation.yml index 109cd28e51..092fbb6fe6 100644 --- a/build/ProjectReunion-BuildFoundation.yml +++ b/build/ProjectReunion-BuildFoundation.yml @@ -5,17 +5,35 @@ name: $(version) trigger: none +variables: +- template: WindowsAppSDK-Versions.yml +- template: WindowsAppSDK-CommonVariables.yml +- template: WindowsAppSDK-Foundation-TestConfig.yml@WindowsAppSDKConfig +# If we pass ${{ variables['Build.SourceBranch'] }} directly to ref: below, then in a PR validation pipeline run scenario, +# there will be an error parsing the resources->repositories->repository->WindowsAppSDKAggregatorSourceBranch because +# the branch Build.SourceBranch does not exist on the Agg repo. Avoid hitting that error by redirecting to the Main branch. +- name: mySourceBranch + ${{ if eq(variables['Build.Reason'], 'PullRequest') }}: + value: refs/heads/main + ${{ else }}: + value: ${{ variables['Build.SourceBranch'] }} + resources: repositories: - repository: WindowsAppSDKConfig type: git name: ProjectReunion/WindowsAppSDKConfig ref: refs/heads/main - -variables: -- template: WindowsAppSDK-Versions.yml -- template: WindowsAppSDK-CommonVariables.yml -- template: WindowsAppSDK-Foundation-TestConfig.yml@WindowsAppSDKConfig + # Depending on the settings of this pipeline run, we will use exactly one of the following two definitions for the Agg repo. + # Either we reference the Main branch, or the same branch as the branch that this pipeline is currently being run against. + - repository: WindowsAppSDKAggregatorSourceBranch + type: git + name: ProjectReunion/WindowsAppSDKAggregator + ref: ${{ variables['mySourceBranch'] }} + - repository: WindowsAppSDKAggregatorMainBranch + type: git + name: ProjectReunion/WindowsAppSDKAggregator + ref: refs/heads/main stages: - template: AzurePipelinesTemplates\WindowsAppSDK-BuildInstaller-Stage.yml@self diff --git a/build/ProjectReunion-CI.yml b/build/ProjectReunion-CI.yml index c3a60f9ebc..f0f0433437 100644 --- a/build/ProjectReunion-CI.yml +++ b/build/ProjectReunion-CI.yml @@ -6,6 +6,27 @@ variables: - template: WindowsAppSDK-CommonVariables.yml - name: buildOutputDir value: $(Build.SourcesDirectory)\BuildOutput +# If we pass ${{ variables['Build.SourceBranch'] }} directly to ref: below, then in a PR validation pipeline run scenario, +# there will be an error parsing the resources->repositories->repository->WindowsAppSDKAggregatorSourceBranch because +# the branch Build.SourceBranch does not exist on the Agg repo. Avoid hitting that error by redirecting to the Main branch. +- name: mySourceBranch + ${{ if eq(variables['Build.Reason'], 'PullRequest') }}: + value: refs/heads/main + ${{ else }}: + value: ${{ variables['Build.SourceBranch'] }} + +resources: + repositories: + # Depending on the settings of this pipeline run, we will use exactly one of the following two definitions for the Agg repo. + # Either we reference the Main branch, or the same branch as the branch that this pipeline is currently being run against. + - repository: WindowsAppSDKAggregatorSourceBranch + type: git + name: ProjectReunion/WindowsAppSDKAggregator + ref: ${{ variables['mySourceBranch'] }} + - repository: WindowsAppSDKAggregatorMainBranch + type: git + name: ProjectReunion/WindowsAppSDKAggregator + ref: refs/heads/main jobs: - job: PreChecks diff --git a/build/WindowsAppSDK-CommonVariables.yml b/build/WindowsAppSDK-CommonVariables.yml index b637e11239..d81b710d7a 100644 --- a/build/WindowsAppSDK-CommonVariables.yml +++ b/build/WindowsAppSDK-CommonVariables.yml @@ -19,10 +19,14 @@ variables: # Native compiler version override for win undock. The two values below are for Ge, defined in: # https://dev.azure.com/microsoft/OS/_git/UndockedES?path=/Pipelines/Config/CompilerToolsSettings.json - compilerOverridePackageName: "DevDiv.rel.LKG18.VCTools" - compilerOverridePackageVersion: "19.42.3443710001+DevDivGIT.CI20250110.04-466784EE54DF2F302AD0CD6790031C954EF41DA23DA4415D73A76ADF260F2D21" + # Normally, the 3 variables below should remain null, so that we resort to using the corresponding global_compilerOverride* + # values for compiling native code. Another legitimate scenario is to point all 3 variables below to a different LKG compiler + # version, say, for working around a problem with the LKG compiler pointed at by the corresponding global_compilerOverride* + # values, for compiling native code. + compilerOverridePackageName: "" + compilerOverridePackageVersion: "" # Use the following corresponding version string instead of the above when calling nuget install directly. - compilerOverrideNupkgVersion: "19.42.34437100" + compilerOverrideNupkgVersion: "" # Docker image which is used to build the project https://aka.ms/obpipelines/containers WindowsContainerImage: 'onebranch.azurecr.io/windows/ltsc2019/vse2022:latest' diff --git a/build/WindowsAppSDK-Foundation-Nightly.yml b/build/WindowsAppSDK-Foundation-Nightly.yml index c0e84fc662..4d1cd46a32 100644 --- a/build/WindowsAppSDK-Foundation-Nightly.yml +++ b/build/WindowsAppSDK-Foundation-Nightly.yml @@ -34,6 +34,19 @@ parameters: type: boolean default: true +variables: +- template: WindowsAppSDK-Versions.yml +- template: WindowsAppSDK-CommonVariables.yml +- template: WindowsAppSDK-Foundation-TestConfig.yml@WindowsAppSDKConfig +# If we pass ${{ variables['Build.SourceBranch'] }} directly to ref: below, then in a PR validation pipeline run scenario, +# there will be an error parsing the resources->repositories->repository->WindowsAppSDKAggregatorSourceBranch because +# the branch Build.SourceBranch does not exist on the Agg repo. Avoid hitting that error by redirecting to the Main branch. +- name: mySourceBranch + ${{ if eq(variables['Build.Reason'], 'PullRequest') }}: + value: refs/heads/main + ${{ else }}: + value: ${{ variables['Build.SourceBranch'] }} + resources: repositories: - repository: templates @@ -44,11 +57,16 @@ resources: type: git name: ProjectReunion/WindowsAppSDKConfig ref: refs/heads/main - -variables: -- template: WindowsAppSDK-Versions.yml -- template: WindowsAppSDK-CommonVariables.yml -- template: WindowsAppSDK-Foundation-TestConfig.yml@WindowsAppSDKConfig + # Depending on the settings of this pipeline run, we will use exactly one of the following two definitions for the Agg repo. + # Either we reference the Main branch, or the same branch as the branch that this pipeline is currently being run against. + - repository: WindowsAppSDKAggregatorSourceBranch + type: git + name: ProjectReunion/WindowsAppSDKAggregator + ref: ${{ variables['mySourceBranch'] }} + - repository: WindowsAppSDKAggregatorMainBranch + type: git + name: ProjectReunion/WindowsAppSDKAggregator + ref: refs/heads/main extends: template: v2/Microsoft.NonOfficial.yml@templates # https://aka.ms/obpipelines/templates diff --git a/build/WindowsAppSDK-Foundation-Official.yml b/build/WindowsAppSDK-Foundation-Official.yml index 03a639fbb6..bb4cc59168 100644 --- a/build/WindowsAppSDK-Foundation-Official.yml +++ b/build/WindowsAppSDK-Foundation-Official.yml @@ -34,6 +34,19 @@ parameters: type: boolean default: true +variables: +- template: WindowsAppSDK-Versions.yml +- template: WindowsAppSDK-CommonVariables.yml +- template: WindowsAppSDK-Foundation-TestConfig.yml@WindowsAppSDKConfig +# If we pass ${{ variables['Build.SourceBranch'] }} directly to ref: below, then in a PR validation pipeline run scenario, +# there will be an error parsing the resources->repositories->repository->WindowsAppSDKAggregatorSourceBranch because +# the branch Build.SourceBranch does not exist on the Agg repo. Avoid hitting that error by redirecting to the Main branch. +- name: mySourceBranch + ${{ if eq(variables['Build.Reason'], 'PullRequest') }}: + value: refs/heads/main + ${{ else }}: + value: ${{ variables['Build.SourceBranch'] }} + resources: repositories: - repository: templates @@ -44,11 +57,16 @@ resources: type: git name: ProjectReunion/WindowsAppSDKConfig ref: refs/heads/main - -variables: -- template: WindowsAppSDK-Versions.yml -- template: WindowsAppSDK-CommonVariables.yml -- template: WindowsAppSDK-Foundation-TestConfig.yml@WindowsAppSDKConfig + # Depending on the settings of this pipeline run, we will use exactly one of the following two definitions for the Agg repo. + # Either we reference the Main branch, or the same branch as the branch that this pipeline is currently being run against. + - repository: WindowsAppSDKAggregatorSourceBranch + type: git + name: ProjectReunion/WindowsAppSDKAggregator + ref: ${{ variables['mySourceBranch'] }} + - repository: WindowsAppSDKAggregatorMainBranch + type: git + name: ProjectReunion/WindowsAppSDKAggregator + ref: refs/heads/main extends: template: v2/Microsoft.Official.yml@templates # https://aka.ms/obpipelines/templates diff --git a/build/WindowsAppSDK-Foundation-PR.yml b/build/WindowsAppSDK-Foundation-PR.yml index 02b35292ac..7247cb1ec8 100644 --- a/build/WindowsAppSDK-Foundation-PR.yml +++ b/build/WindowsAppSDK-Foundation-PR.yml @@ -25,6 +25,19 @@ parameters: # parameters are shown up in ADO UI in a build queue time type: boolean default: true +variables: +- template: WindowsAppSDK-Versions.yml +- template: WindowsAppSDK-CommonVariables.yml +- template: WindowsAppSDK-Foundation-TestConfig.yml@WindowsAppSDKConfig +# If we pass ${{ variables['Build.SourceBranch'] }} directly to ref: below, then in a PR validation pipeline run scenario, +# there will be an error parsing the resources->repositories->repository->WindowsAppSDKAggregatorSourceBranch because +# the branch Build.SourceBranch does not exist on the Agg repo. Avoid hitting that error by redirecting to the Main branch. +- name: mySourceBranch + ${{ if eq(variables['Build.Reason'], 'PullRequest') }}: + value: refs/heads/main + ${{ else }}: + value: ${{ variables['Build.SourceBranch'] }} + resources: repositories: - repository: templates @@ -35,11 +48,16 @@ resources: type: git name: ProjectReunion/WindowsAppSDKConfig ref: refs/heads/main - -variables: -- template: WindowsAppSDK-Versions.yml -- template: WindowsAppSDK-CommonVariables.yml -- template: WindowsAppSDK-Foundation-TestConfig.yml@WindowsAppSDKConfig + # Depending on the settings of this pipeline run, we will use exactly one of the following two definitions for the Agg repo. + # Either we reference the Main branch, or the same branch as the branch that this pipeline is currently being run against. + - repository: WindowsAppSDKAggregatorSourceBranch + type: git + name: ProjectReunion/WindowsAppSDKAggregator + ref: ${{ variables['mySourceBranch'] }} + - repository: WindowsAppSDKAggregatorMainBranch + type: git + name: ProjectReunion/WindowsAppSDKAggregator + ref: refs/heads/main extends: template: v2/Microsoft.NonOfficial.yml@templates # https://aka.ms/obpipelines/templates