From fb00f305874ac1554b9157078ad8907e54c4a478 Mon Sep 17 00:00:00 2001 From: Andy Zivkovic Date: Wed, 15 Oct 2025 10:17:17 +1030 Subject: [PATCH 1/2] CI pipelines should work when branch has slash (#6853) --- eng/pipelines/official.yml | 1 + eng/pipelines/optprof.yml | 6 +++--- eng/pipelines/pull_request.yml | 3 +++ eng/pipelines/templates/Build_and_UnitTest.yml | 6 +++--- eng/pipelines/templates/Initialize_Build.yml | 10 +--------- eng/pipelines/templates/pipeline.yml | 8 ++++---- eng/pipelines/vs-test/build.yml | 6 +++--- eng/pipelines/vs-tests.yml | 1 + 8 files changed, 19 insertions(+), 22 deletions(-) diff --git a/eng/pipelines/official.yml b/eng/pipelines/official.yml index ad490c0e195..d25b2d962a6 100644 --- a/eng/pipelines/official.yml +++ b/eng/pipelines/official.yml @@ -66,6 +66,7 @@ variables: RunMonoTestsOnMac: ${{ parameters.RunMonoTestsOnMac }} RunStaticAnalysis: ${{ parameters.RunStaticAnalysis }} OneLocBranch: 'dev' + SourceBranch: $[replace(variables['Build.SourceBranch'], 'refs/heads/', '')] extends: template: azure-pipelines/MicroBuild.1ES.Official.yml@MicroBuildTemplate diff --git a/eng/pipelines/optprof.yml b/eng/pipelines/optprof.yml index 914fd77d4f6..5c9468f3f41 100644 --- a/eng/pipelines/optprof.yml +++ b/eng/pipelines/optprof.yml @@ -144,7 +144,7 @@ stages: } catch { Write-Host $_ - Write-Error "Failed to set SourceBranchName pipeline variable" + Write-Error "Failed to set RunSettingsURI pipeline variable" throw } displayName: 'Set RunSettingsURI variable' @@ -180,10 +180,10 @@ stages: filePath: $(DartLab.Path)\Scripts\VisualStudio\Bootstrapper\Get-BootstrapperURL.ps1 arguments: -BootstrapperInfoJsonURI '$(Build.StagingDirectory)\MicroBuild\Output\BootstrapperInfo.json' -VSBranch '$(VSBranch)' -OutVariableName 'VisualStudio.InstallationUnderTest.BootstrapperURL' - task: artifactDropTask@0 - displayName: "Upload VSTS Drop" + displayName: "Upload VS Bootstrapper" inputs: dropServiceURI: 'https://devdiv.artifacts.visualstudio.com' - buildNumber: 'Products/$(System.TeamProject)/$(Build.Repository.Name)/$(Build.SourceBranchName)/$(Build.BuildNumber)' + buildNumber: '$(MicroBuild.ManifestDropName)' sourcePath: "$(Pipeline.Workspace)\\ComponentBuildUnderTest\\VS15" toLowerCase: false usePat: true diff --git a/eng/pipelines/pull_request.yml b/eng/pipelines/pull_request.yml index ea448ff259b..f6357f83867 100644 --- a/eng/pipelines/pull_request.yml +++ b/eng/pipelines/pull_request.yml @@ -46,6 +46,7 @@ resources: type: git name: 1ESPipelineTemplates/MicroBuildTemplate ref: refs/tags/release + variables: BINLOG_DIRECTORY: $(Build.StagingDirectory)/binlog DOTNET_NOLOGO: 1 @@ -61,6 +62,8 @@ variables: RunTestsOnMac: ${{ parameters.RunTestsOnMac }} RunMonoTestsOnMac: ${{ parameters.RunMonoTestsOnMac }} RunStaticAnalysis: ${{ parameters.RunStaticAnalysis }} + SourceBranch: $[replace(variables['Build.SourceBranch'], 'refs/heads/', '')] + extends: template: azure-pipelines/MicroBuild.1ES.Unofficial.yml@MicroBuildTemplate parameters: diff --git a/eng/pipelines/templates/Build_and_UnitTest.yml b/eng/pipelines/templates/Build_and_UnitTest.yml index 482b97428cf..3166b721f2f 100644 --- a/eng/pipelines/templates/Build_and_UnitTest.yml +++ b/eng/pipelines/templates/Build_and_UnitTest.yml @@ -19,7 +19,7 @@ steps: - task: PowerShell@1 inputs: scriptName: "$(Build.Repository.LocalPath)\\scripts\\cibuild\\ConfigureVstsBuild.ps1" - arguments: "-BuildRTM $(BuildRTM) -RepositoryPath $(Build.Repository.LocalPath) -BranchName $(Build.SourceBranchName) -CommitHash $(Build.SourceVersion) -BuildNumber $(Build.BuildNumber)" + arguments: "-BuildRTM $(BuildRTM) -RepositoryPath $(Build.Repository.LocalPath) -BranchName $(SourceBranch) -CommitHash $(Build.SourceVersion) -BuildNumber $(Build.BuildNumber)" displayName: "Configure VSTS CI Environment" - task: PowerShell@1 @@ -333,7 +333,7 @@ steps: displayName: "Generate .runsettings files" inputs: solution: 'build\runsettings.proj' - msbuildArguments: '/restore:false /property:OutputPath="$(Build.Repository.LocalPath)\artifacts\RunSettings" /property:TestDrop="RunSettings/$(System.TeamProject)/$(Build.Repository.Name)/$(Build.SourceBranchName)/$(Build.BuildId)" /property:ProfilingInputsDrop="ProfilingInputs/$(System.TeamProject)/$(Build.Repository.Name)/$(Build.SourceBranchName)/$(Build.BuildId)" /binarylogger:$(Build.StagingDirectory)\\binlog\\17.GenerateRunSettings.binlog' + msbuildArguments: '/restore:false /property:OutputPath="$(Build.Repository.LocalPath)\artifacts\RunSettings" /property:TestDrop="RunSettings/$(System.TeamProject)/$(Build.Repository.Name)/$(SourceBranch)/$(Build.BuildId)" /property:ProfilingInputsDrop="ProfilingInputs/$(System.TeamProject)/$(Build.Repository.Name)/$(SourceBranch)/$(Build.BuildId)" /binarylogger:$(Build.StagingDirectory)\\binlog\\17.GenerateRunSettings.binlog' condition: "and(succeeded(), eq(variables['BuildRTM'], 'false'))" - task: PowerShell@1 @@ -400,7 +400,7 @@ steps: scriptType: ps scriptLocation: inlineScript inlineScript: | - $(Agent.TempDirectory)/dotnet/dotnet msbuild $(Build.Repository.LocalPath)\build\publish.proj /t:PublishToBuildAssetRegistry /property:NuGetClientNupkgsDirectoryPath=$(Build.Repository.LocalPath)\artifacts\$(NupkgOutputDir) /property:BUILD_BUILDNUMBER=$(Build.BuildNumber) /property:BUILD_SOURCEBRANCH=$(Build.SourceBranchName) /property:BUILD_SOURCEVERSION=$(Build.SourceVersion) /property:BUILD_REPOSITORY_URI=$(Build.Repository.Uri) /property:BUILD_REPOSITORY_NAME=$(Build.Repository.Name) /property:ArtifactsLogDir=$(Build.Repository.LocalPath)\artifacts\manifests\ /binarylogger:$(Build.StagingDirectory)\binlog\21.PublishToBuildAssetRegistry.binlog /property:MaestroApiEndpoint=$(MaestroApiEndpoint) + $(Agent.TempDirectory)/dotnet/dotnet msbuild $(Build.Repository.LocalPath)\build\publish.proj /t:PublishToBuildAssetRegistry /property:NuGetClientNupkgsDirectoryPath=$(Build.Repository.LocalPath)\artifacts\$(NupkgOutputDir) /property:BUILD_BUILDNUMBER=$(Build.BuildNumber) /property:BUILD_SOURCEBRANCH=$(SourceBranch) /property:BUILD_SOURCEVERSION=$(Build.SourceVersion) /property:BUILD_REPOSITORY_URI=$(Build.Repository.Uri) /property:BUILD_REPOSITORY_NAME=$(Build.Repository.Name) /property:ArtifactsLogDir=$(Build.Repository.LocalPath)\artifacts\manifests\ /binarylogger:$(Build.StagingDirectory)\binlog\21.PublishToBuildAssetRegistry.binlog /property:MaestroApiEndpoint=$(MaestroApiEndpoint) workingDirectory: cli failOnStderr: true env: diff --git a/eng/pipelines/templates/Initialize_Build.yml b/eng/pipelines/templates/Initialize_Build.yml index ce7b878bf66..8ca76b9f1fb 100644 --- a/eng/pipelines/templates/Initialize_Build.yml +++ b/eng/pipelines/templates/Initialize_Build.yml @@ -22,7 +22,7 @@ steps: } else { $targetMajorVersion = ((& dotnet msbuild $env:BUILD_REPOSITORY_LOCALPATH\build\config.props /restore:false "/ConsoleLoggerParameters:Verbosity=Minimal;NoSummary;ForceNoAlign" /nologo /target:GetVsTargetMajorVersion) | Out-String).Trim() } - + Write-Host "##vso[task.setvariable variable=VsTargetChannel;isOutput=true]$targetChannel" Write-Host "##vso[task.setvariable variable=VsTargetChannelForTests;isOutput=true]$targetChannelForTests" Write-Host "##vso[task.setvariable variable=VsTargetMajorVersion;isOutput=true]$targetMajorVersion" @@ -34,13 +34,5 @@ steps: exit 1 } -- task: PowerShell@1 - displayName: "Add Build Tags" - inputs: - scriptType: "inlineScript" - inlineScript: | - Write-Host "##vso[build.addbuildtag]${env:BUILD_SOURCEVERSIONAUTHOR}" - Write-Host "##vso[build.addbuildtag]${env:BUILD_SOURCEBRANCHNAME}" - - task: ComponentGovernanceComponentDetection@0 displayName: 'Component Detection' diff --git a/eng/pipelines/templates/pipeline.yml b/eng/pipelines/templates/pipeline.yml index 7eb9b4145ac..e0cec7157a9 100644 --- a/eng/pipelines/templates/pipeline.yml +++ b/eng/pipelines/templates/pipeline.yml @@ -84,7 +84,7 @@ stages: LclSource: lclFilesfromPackage LclPackageId: 'LCL-JUNO-PROD-NuGetClient' MirrorRepo: 'NuGet.Client' - MirrorBranch: ${{ variables['Build.SourceBranchName'] }} + MirrorBranch: ${{ variables['SourceBranch'] }} GitHubOrg: 'NuGet' - stage: StaticSourceAnalysis @@ -173,7 +173,7 @@ stages: displayName: 'Publish the .runsettings files to artifact services' condition: "succeeded()" dropServiceURI: 'https://devdiv.artifacts.visualstudio.com' - buildNumber: 'RunSettings/$(System.TeamProject)/$(Build.Repository.Name)/$(Build.SourceBranchName)/$(Build.BuildId)' + buildNumber: 'RunSettings/$(System.TeamProject)/$(Build.Repository.Name)/$(SourceBranch)/$(Build.BuildId)' sourcePath: 'artifacts\RunSettings' toLowerCase: false usePat: true @@ -185,7 +185,7 @@ stages: displayName: 'OptProfV2: publish profiling inputs to artifact services' condition: "and(succeeded(), eq(variables['IsOfficialBuild'], 'true'))" dropServiceURI: 'https://devdiv.artifacts.visualstudio.com' - buildNumber: 'ProfilingInputs/$(System.TeamProject)/$(Build.Repository.Name)/$(Build.SourceBranchName)/$(Build.BuildId)' + buildNumber: 'ProfilingInputs/$(System.TeamProject)/$(Build.Repository.Name)/$(SourceBranch)/$(Build.BuildId)' sourcePath: '$(Build.ArtifactStagingDirectory)\OptProf\ProfilingInputs' toLowerCase: false usePat: true @@ -208,7 +208,7 @@ stages: displayName: 'Upload VSTS Drop' condition: "succeeded()" dropServiceURI: 'https://devdiv.artifacts.visualstudio.com' - buildNumber: 'Products/$(System.TeamProject)/$(Build.Repository.Name)/$(Build.SourceBranchName)/$(Build.BuildNumber)' + buildNumber: 'Products/$(System.TeamProject)/$(Build.Repository.Name)/$(SourceBranch)/$(Build.BuildNumber)' sourcePath: "$(Build.Repository.LocalPath)\\artifacts\\VS15" toLowerCase: false usePat: true diff --git a/eng/pipelines/vs-test/build.yml b/eng/pipelines/vs-test/build.yml index 9279c5897ab..e97d6b0b218 100644 --- a/eng/pipelines/vs-test/build.yml +++ b/eng/pipelines/vs-test/build.yml @@ -10,7 +10,7 @@ steps: - task: MicroBuildSwixPlugin@4 displayName: "Install Swix Plugin" inputs: - dropName: "Tests/$(System.TeamProject)/$(Build.DefinitionName)/$(Build.SourceBranchName)/$(Build.BuildId)" + dropName: "Tests/$(System.TeamProject)/$(Build.DefinitionName)/$(SourceBranch)/$(Build.BuildId)" - task: PowerShell@1 displayName: "Run Configure.ps1" inputs: @@ -45,7 +45,7 @@ steps: - task: PowerShell@1 inputs: scriptName: "$(Build.Repository.LocalPath)\\scripts\\cibuild\\ConfigureVstsBuild.ps1" - arguments: "-BuildRTM false -RepositoryPath $(Build.Repository.LocalPath) -BranchName $(Build.SourceBranchName) -CommitHash $(Build.SourceVersion) -BuildNumber $(NuGetVersion)" + arguments: "-BuildRTM false -RepositoryPath $(Build.Repository.LocalPath) -BranchName $(SourceBranch) -CommitHash $(Build.SourceVersion) -BuildNumber $(NuGetVersion)" displayName: "Configure VSTS CI Environment" - task: PowerShell@1 @@ -214,7 +214,7 @@ steps: Write-Host "Base Build Drop: $buildDrop" Write-Host "##vso[task.setvariable variable=BaseBuildDrop;isOutput=true]$buildDrop" - $runSettingsDrop = "RunSettings/${env:System_TeamProject}/${env:Build_DefinitionName}/${env:Build_SourceBranchName}/${env:Build_BuildId}" + $runSettingsDrop = "RunSettings/${env:System_TeamProject}/${env:Build_DefinitionName}/${env:SourceBranch}/${env:Build_BuildId}" Write-Host "Run Settings Drop: $runSettingsDrop" Write-Host "##vso[task.setvariable variable=RunSettingsDrop]$runSettingsDrop" Write-Host "##vso[task.setvariable variable=RunSettingsDrop;isOutput=true]$runSettingsDrop" diff --git a/eng/pipelines/vs-tests.yml b/eng/pipelines/vs-tests.yml index dfd29eb6424..55019d818e1 100644 --- a/eng/pipelines/vs-tests.yml +++ b/eng/pipelines/vs-tests.yml @@ -62,6 +62,7 @@ variables: DOTNET_NOLOGO: 1 CI: true Codeql.Enabled: false + SourceBranch: $[replace(variables['Build.SourceBranch'], 'refs/heads/', '')] stages: - stage: Build From 1fd6e989037871cc481b07318908ac4693556658 Mon Sep 17 00:00:00 2001 From: Jeff Kluge Date: Wed, 15 Oct 2025 14:53:18 -0700 Subject: [PATCH 2/2] Fix syntax to run OneLoc in CI builds (Attempt 2) (#6859) --- eng/pipelines/templates/pipeline.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/pipelines/templates/pipeline.yml b/eng/pipelines/templates/pipeline.yml index e0cec7157a9..60b5be20519 100644 --- a/eng/pipelines/templates/pipeline.yml +++ b/eng/pipelines/templates/pipeline.yml @@ -84,7 +84,7 @@ stages: LclSource: lclFilesfromPackage LclPackageId: 'LCL-JUNO-PROD-NuGetClient' MirrorRepo: 'NuGet.Client' - MirrorBranch: ${{ variables['SourceBranch'] }} + MirrorBranch: ${{ replace(variables['Build.SourceBranch'], 'refs/heads/', '') }} GitHubOrg: 'NuGet' - stage: StaticSourceAnalysis