diff --git a/azure-pipelines-public.yml b/azure-pipelines-public.yml
index fc9d13bc512..8f65cab9ff8 100644
--- a/azure-pipelines-public.yml
+++ b/azure-pipelines-public.yml
@@ -133,6 +133,7 @@ stages:
skipQualityGates: ${{ eq(variables['SkipQualityGates'], 'true') }}
isWindows: true
warnAsError: 0
+ runAsPublic: true
# ----------------------------------------------------------------
# This job build and run tests on Ubuntu
@@ -164,6 +165,7 @@ stages:
skipQualityGates: ${{ eq(variables['SkipQualityGates'], 'true') }}
isWindows: false
warnAsError: 0
+ runAsPublic: true
# ----------------------------------------------------------------
diff --git a/azure-pipelines.yml b/azure-pipelines.yml
index a695dd6529a..31f7a78694d 100644
--- a/azure-pipelines.yml
+++ b/azure-pipelines.yml
@@ -108,229 +108,229 @@ variables:
- name: _Sign
value: true
-stages:
-- stage: build
- displayName: Build
- variables:
- - template: /eng/common/templates/variables/pool-providers.yml
- jobs:
- - template: /eng/common/templates/jobs/jobs.yml
- parameters:
- enableMicrobuild: true
- enableTelemetry: true
- enableSourceIndex: false
- runAsPublic: ${{ variables['runAsPublic'] }}
- # Publish build logs
- enablePublishBuildArtifacts: true
- # Publish test logs
- enablePublishTestResults: true
- # Publish NuGet packages using v3
- # https://github.com/dotnet/arcade/blob/main/Documentation/CorePackages/Publishing.md#basic-onboarding-scenario-for-new-repositories-to-the-current-publishing-version-v3
- enablePublishUsingPipelines: true
- enablePublishBuildAssets: true
- workspace:
- clean: all
-
+resources:
+ repositories:
+ - repository: 1ESPipelineTemplates
+ type: git
+ name: 1ESPipelineTemplates/1ESPipelineTemplates
+ ref: refs/tags/release
+
+extends:
+ template: v1/1ES.Official.PipelineTemplate.yml@1ESPipelineTemplates
+ parameters:
+ sdl:
+ sourceAnalysisPool:
+ name: NetCore1ESPool-Internal
+ image: windows.vs2022preview.amd64
+ os: windows
+ customBuildTags:
+ - ES365AIMigrationTooling
+
+ stages:
+ - stage: build
+ displayName: Build
+ variables:
+ - template: /eng/common/templates-official/variables/pool-providers.yml@self
jobs:
-
- # ----------------------------------------------------------------
- # This job build and run tests on Windows
- # ----------------------------------------------------------------
- - job: Windows
- timeoutInMinutes: 180
- testResultsFormat: VSTest
-
- pool:
- ${{ if eq(variables['runAsPublic'], 'true') }}:
- name: $(DncEngPublicBuildPool)
- demands: ImageOverride -equals windows.vs2022preview.amd64.open
- # Non-public (i.e., official builds)
- ${{ else }}:
- name: $(DncEngInternalBuildPool)
- demands: ImageOverride -equals windows.vs2022preview.amd64
-
- variables:
- - _buildScript: $(Build.SourcesDirectory)/build.cmd -ci -NativeToolsOnMachine
-
- preSteps:
- - checkout: self
- clean: true
- persistCredentials: true
- fetchDepth: 1
-
- steps:
- - template: /eng/pipelines/templates/BuildAndTest.yml
- parameters:
- buildScript: $(_buildScript)
- buildConfig: $(_BuildConfig)
- repoLogPath: $(Build.Arcade.LogsPath)
- repoTestResultsPath: $(Build.Arcade.TestResultsPath)
- skipQualityGates: ${{ eq(variables['SkipQualityGates'], 'true') }}
- isWindows: true
- warnAsError: 0
-
- # ----------------------------------------------------------------
- # This job build and run tests on Ubuntu
- # ----------------------------------------------------------------
- - job: Ubuntu
- timeoutInMinutes: 180
- testResultsFormat: VSTest
-
- pool:
- ${{ if eq(variables['runAsPublic'], 'true') }}:
- name: $(DncEngPublicBuildPool)
- demands: ImageOverride -equals build.ubuntu.2004.amd64.open
- # Non-public (i.e., official builds)
- ${{ else }}:
- name: $(DncEngInternalBuildPool)
- demands: ImageOverride -equals build.ubuntu.2004.amd64
-
- variables:
- - _buildScript: $(Build.SourcesDirectory)/build.sh --ci
-
- preSteps:
- - checkout: self
- clean: true
- persistCredentials: true
- fetchDepth: 1
-
- steps:
- - template: /eng/pipelines/templates/BuildAndTest.yml
- parameters:
- buildScript: $(_buildScript)
- buildConfig: $(_BuildConfig)
- repoLogPath: $(Build.Arcade.LogsPath)
- repoTestResultsPath: $(Build.Arcade.TestResultsPath)
- skipQualityGates: ${{ eq(variables['SkipQualityGates'], 'true') }}
- isWindows: false
- warnAsError: 0
-
-
-# ----------------------------------------------------------------
-# This stage performs quality gates enforcements
-# ----------------------------------------------------------------
-- stage: codecoverage
- displayName: CodeCoverage
- dependsOn:
- - build
- condition: and(succeeded('build'), ne(variables['SkipQualityGates'], 'true'))
- variables:
- - template: /eng/common/templates/variables/pool-providers.yml
- jobs:
- - template: /eng/common/templates/jobs/jobs.yml
- parameters:
- enableMicrobuild: true
- enableTelemetry: true
- runAsPublic: ${{ variables['runAsPublic'] }}
- workspace:
- clean: all
-
- # ----------------------------------------------------------------
- # This stage downloads the code coverage reports from the build jobs,
- # merges those and validates the combined test coverage.
- # ----------------------------------------------------------------
+ - template: /eng/common/templates-official/jobs/jobs.yml@self
+ parameters:
+ enableMicrobuild: true
+ enableTelemetry: true
+ enableSourceIndex: false
+ runAsPublic: ${{ variables['runAsPublic'] }}
+ # Publish build logs
+ enablePublishBuildArtifacts: true
+ # Publish test logs
+ enablePublishTestResults: true
+ # Publish NuGet packages using v3
+ # https://github.com/dotnet/arcade/blob/main/Documentation/CorePackages/Publishing.md#basic-onboarding-scenario-for-new-repositories-to-the-current-publishing-version-v3
+ enablePublishUsingPipelines: true
+ enablePublishBuildAssets: true
+ workspace:
+ clean: all
+
+ jobs:
+
+ # ----------------------------------------------------------------
+ # This job build and run tests on Windows
+ # ----------------------------------------------------------------
+ - job: Windows
+ timeoutInMinutes: 180
+ testResultsFormat: VSTest
+ pool:
+ name: NetCore1ESPool-Internal
+ image: windows.vs2022preview.amd64
+ os: windows
+
+ variables:
+ - _buildScript: $(Build.SourcesDirectory)/build.cmd -ci -NativeToolsOnMachine
+
+ preSteps:
+ - checkout: self
+ clean: true
+ persistCredentials: true
+ fetchDepth: 1
+
+ steps:
+ - template: /eng/pipelines/templates/BuildAndTest.yml
+ parameters:
+ buildScript: $(_buildScript)
+ buildConfig: $(_BuildConfig)
+ repoLogPath: $(Build.Arcade.LogsPath)
+ repoTestResultsPath: $(Build.Arcade.TestResultsPath)
+ skipQualityGates: ${{ eq(variables['SkipQualityGates'], 'true') }}
+ isWindows: true
+ warnAsError: 0
+
+ # ----------------------------------------------------------------
+ # This job build and run tests on Ubuntu
+ # ----------------------------------------------------------------
+ - job: Ubuntu
+ timeoutInMinutes: 180
+ testResultsFormat: VSTest
+ pool:
+ name: NetCore1ESPool-Internal
+ image: 1es-mariner-2-pt
+ os: linux
+
+ variables:
+ - _buildScript: $(Build.SourcesDirectory)/build.sh --ci
+
+ preSteps:
+ - checkout: self
+ clean: true
+ persistCredentials: true
+ fetchDepth: 1
+
+ steps:
+ - template: /eng/pipelines/templates/BuildAndTest.yml
+ parameters:
+ buildScript: $(_buildScript)
+ buildConfig: $(_BuildConfig)
+ repoLogPath: $(Build.Arcade.LogsPath)
+ repoTestResultsPath: $(Build.Arcade.TestResultsPath)
+ skipQualityGates: ${{ eq(variables['SkipQualityGates'], 'true') }}
+ isWindows: false
+ warnAsError: 0
+
+ # ----------------------------------------------------------------
+ # This stage performs quality gates enforcements
+ # ----------------------------------------------------------------
+ - stage: codecoverage
+ displayName: CodeCoverage
+ dependsOn:
+ - build
+ condition: and(succeeded('build'), ne(variables['SkipQualityGates'], 'true'))
+ variables:
+ - template: /eng/common/templates-official/variables/pool-providers.yml@self
jobs:
- - job: CodeCoverageReport
- timeoutInMinutes: 180
-
- pool:
- ${{ if eq(variables['runAsPublic'], 'true') }}:
- name: $(DncEngPublicBuildPool)
- demands: ImageOverride -equals build.ubuntu.2004.amd64.open
- # Non-public (i.e., official builds)
- ${{ else }}:
- name: $(DncEngInternalBuildPool)
- demands: ImageOverride -equals build.ubuntu.2004.amd64
-
- preSteps:
- - checkout: self
- clean: true
- persistCredentials: true
- fetchDepth: 1
-
- steps:
- - script: $(Build.SourcesDirectory)/build.sh --ci --restore
- displayName: Init toolset
-
- - template: /eng/pipelines/templates/VerifyCoverageReport.yml
-
-
-# ----------------------------------------------------------------
-# This stage only performs a build treating warnings as errors
-# to detect any kind of code style violations
-# ----------------------------------------------------------------
-- stage: correctness
- displayName: Correctness
- dependsOn: []
- variables:
- - template: /eng/common/templates/variables/pool-providers.yml
- jobs:
- - template: /eng/common/templates/jobs/jobs.yml
- parameters:
- enableMicrobuild: true
- enableTelemetry: true
- runAsPublic: ${{ variables['runAsPublic'] }}
- workspace:
- clean: all
-
+ - template: /eng/common/templates-official/jobs/jobs.yml@self
+ parameters:
+ enableMicrobuild: true
+ enableTelemetry: true
+ runAsPublic: ${{ variables['runAsPublic'] }}
+ workspace:
+ clean: all
+
+ # ----------------------------------------------------------------
+ # This stage downloads the code coverage reports from the build jobs,
+ # merges those and validates the combined test coverage.
+ # ----------------------------------------------------------------
+ jobs:
+ - job: CodeCoverageReport
+ timeoutInMinutes: 180
+
+ pool:
+ name: NetCore1ESPool-Internal
+ image: 1es-mariner-2-pt
+ os: linux
+
+ preSteps:
+ - checkout: self
+ clean: true
+ persistCredentials: true
+ fetchDepth: 1
+
+ steps:
+ - script: $(Build.SourcesDirectory)/build.sh --ci --restore
+ displayName: Init toolset
+
+ - template: /eng/pipelines/templates/VerifyCoverageReport.yml
+
+
+ # ----------------------------------------------------------------
+ # This stage only performs a build treating warnings as errors
+ # to detect any kind of code style violations
+ # ----------------------------------------------------------------
+ - stage: correctness
+ displayName: Correctness
+ dependsOn: []
+ variables:
+ - template: /eng/common/templates-official/variables/pool-providers.yml@self
jobs:
- - job: WarningsCheck
- timeoutInMinutes: 180
-
- pool:
- ${{ if eq(variables['runAsPublic'], 'true') }}:
- name: $(DncEngPublicBuildPool)
- demands: ImageOverride -equals build.ubuntu.2004.amd64.open
- # Non-public (i.e., official builds)
- ${{ else }}:
- name: $(DncEngInternalBuildPool)
- demands: ImageOverride -equals build.ubuntu.2004.amd64
-
- variables:
- - _buildScript: $(Build.SourcesDirectory)/build.sh --ci
-
- preSteps:
- - checkout: self
- clean: true
- persistCredentials: true
- fetchDepth: 1
-
- steps:
- - template: \eng\pipelines\templates\BuildAndTest.yml
- parameters:
- buildScript: $(_buildScript)
- buildConfig: $(_BuildConfig)
- repoLogPath: $(Build.Arcade.LogsPath)
- repoTestResultsPath: $(Build.Arcade.TestResultsPath)
- skipTests: true
- skipQualityGates: true
- isWindows: false
-
-
-# Publish and validation steps. Only run in official builds
-- ${{ if and(ne(variables['runAsPublic'], 'true'), notin(variables['Build.Reason'], 'PullRequest')) }}:
- - template: /eng/common/templates/post-build/post-build.yml
- parameters:
- validateDependsOn:
- - build
- - codecoverage
- - correctness
- publishingInfraVersion: 3
- enableSymbolValidation: false
- enableSigningValidation: false
- enableNugetValidation: false
- enableSourceLinkValidation: false
- # these param values come from the DotNet-Winforms-SDLValidation-Params azdo variable group
- SDLValidationParameters:
- enable: false
- params: ' -SourceToolsList $(_TsaSourceToolsList)
- -TsaInstanceURL $(_TsaInstanceURL)
- -TsaProjectName $(_TsaProjectName)
- -TsaNotificationEmail $(_TsaNotificationEmail)
- -TsaCodebaseAdmin $(_TsaCodebaseAdmin)
- -TsaBugAreaPath $(_TsaBugAreaPath)
- -TsaIterationPath $(_TsaIterationPath)
- -TsaRepositoryName $(_TsaRepositoryName)
- -TsaCodebaseName $(_TsaCodebaseName)
- -TsaOnboard $(_TsaOnboard)
- -TsaPublish $(_TsaPublish)'
+ - template: /eng/common/templates-official/jobs/jobs.yml@self
+ parameters:
+ enableMicrobuild: true
+ enableTelemetry: true
+ runAsPublic: ${{ variables['runAsPublic'] }}
+ workspace:
+ clean: all
+
+ jobs:
+ - job: WarningsCheck
+ timeoutInMinutes: 180
+
+ pool:
+ ${{ if eq(variables['runAsPublic'], 'true') }}:
+ name: NetCore1ESPool-Internal
+ image: 1es-mariner-2-pt
+ os: linux
+
+ variables:
+ - _buildScript: $(Build.SourcesDirectory)/build.sh --ci
+
+ preSteps:
+ - checkout: self
+ clean: true
+ persistCredentials: true
+ fetchDepth: 1
+
+ steps:
+ - template: '\eng\pipelines\templates\BuildAndTest.yml'
+ parameters:
+ buildScript: $(_buildScript)
+ buildConfig: $(_BuildConfig)
+ repoLogPath: $(Build.Arcade.LogsPath)
+ repoTestResultsPath: $(Build.Arcade.TestResultsPath)
+ skipTests: true
+ skipQualityGates: true
+ isWindows: false
+
+
+ # Publish and validation steps. Only run in official builds
+ - ${{ if and(ne(variables['runAsPublic'], 'true'), notin(variables['Build.Reason'], 'PullRequest')) }}:
+ - template: /eng/common/templates-official/post-build/post-build.yml@self
+ parameters:
+ validateDependsOn:
+ - build
+ - codecoverage
+ - correctness
+ publishingInfraVersion: 3
+ enableSymbolValidation: false
+ enableSigningValidation: false
+ enableNugetValidation: false
+ enableSourceLinkValidation: false
+ # these param values come from the DotNet-Winforms-SDLValidation-Params azdo variable group
+ SDLValidationParameters:
+ enable: false
+ params: ' -SourceToolsList $(_TsaSourceToolsList)
+ -TsaInstanceURL $(_TsaInstanceURL)
+ -TsaProjectName $(_TsaProjectName)
+ -TsaNotificationEmail $(_TsaNotificationEmail)
+ -TsaCodebaseAdmin $(_TsaCodebaseAdmin)
+ -TsaBugAreaPath $(_TsaBugAreaPath)
+ -TsaIterationPath $(_TsaIterationPath)
+ -TsaRepositoryName $(_TsaRepositoryName)
+ -TsaCodebaseName $(_TsaCodebaseName)
+ -TsaOnboard $(_TsaOnboard)
+ -TsaPublish $(_TsaPublish)'
diff --git a/eng/packages/General.props b/eng/packages/General.props
index b128d272acc..8b467ebc314 100644
--- a/eng/packages/General.props
+++ b/eng/packages/General.props
@@ -54,6 +54,7 @@
+
diff --git a/eng/pipelines/templates/BuildAndTest.yml b/eng/pipelines/templates/BuildAndTest.yml
index 6252a2c6337..ced3ce0afb3 100644
--- a/eng/pipelines/templates/BuildAndTest.yml
+++ b/eng/pipelines/templates/BuildAndTest.yml
@@ -18,6 +18,9 @@ parameters:
- name: warnAsError
type: number
default: 1
+ - name: runAsPublic
+ type: boolean
+ default: false
steps:
- script: ${{ parameters.buildScript }}
@@ -45,7 +48,7 @@ steps:
- ${{ if ne(parameters.skipTests, 'true') }}:
- script: $(Build.SourcesDirectory)/.dotnet/dotnet dotnet-coverage collect
--settings $(Build.SourcesDirectory)/eng/CodeCoverage.config
- --output ${{ parameters.repoTestResultsPath }}/$(Agent.Os)_$(Agent.JobName).cobertura.xml
+ --output ${{ parameters.repoTestResultsPath }}/$(Agent.JobName)_CodeCoverageResults/$(Agent.JobName)_cobertura.xml
"${{ parameters.buildScript }} -test -configuration ${{ parameters.buildConfig }} /bl:${{ parameters.repoLogPath }}/tests.binlog $(_OfficialBuildIdArgs)"
displayName: Run tests
@@ -66,12 +69,20 @@ steps:
continueOnError: true
- ${{ if ne(parameters.skipQualityGates, 'true') }}:
- - task: PublishBuildArtifacts@1
- displayName: Publish coverage results (cobertura.xml)
- inputs:
- PathtoPublish: '${{ parameters.repoTestResultsPath }}/$(Agent.Os)_$(Agent.JobName).cobertura.xml'
- PublishLocation: Container
- ArtifactName: CodeCoverageResults
+ - ${{ if eq(parameters.runAsPublic, 'true') }}:
+ - task: PublishPipelineArtifact@1
+ displayName: Publish coverage results (cobertura.xml)
+ inputs:
+ targetPath: '${{ parameters.repoTestResultsPath }}/$(Agent.JobName)_CodeCoverageResults'
+ artifactName: "$(Agent.JobName)_CodeCoverageResults"
+ publishLocation: 'pipeline'
+
+ - ${{ if ne(parameters.runAsPublic, 'true') }}:
+ - task: 1ES.PublishPipelineArtifact@1
+ displayName: Publish coverage results (cobertura.xml)
+ inputs:
+ targetPath: '${{ parameters.repoTestResultsPath }}/$(Agent.JobName)_CodeCoverageResults'
+ artifactName: "$(Agent.JobName)_CodeCoverageResults"
- ${{ if eq(parameters.isWindows, 'true') }}:
- script: ${{ parameters.buildScript }}
diff --git a/eng/pipelines/templates/VerifyCoverageReport.yml b/eng/pipelines/templates/VerifyCoverageReport.yml
index 5c55d4d42de..49f34e3cd63 100644
--- a/eng/pipelines/templates/VerifyCoverageReport.yml
+++ b/eng/pipelines/templates/VerifyCoverageReport.yml
@@ -1,18 +1,32 @@
steps:
- - task: DownloadBuildArtifacts@0
- displayName: Download code coverage reports
+
+ # This downloads Windows_cobertura.xml from Windows_CodeCoverageResults artifact to the root of the repo
+ - task: DownloadPipelineArtifact@2
+ displayName: Download Windows code coverage reports
+ inputs:
+ buildType: 'current'
+ artifactName: Windows_CodeCoverageResults
+ itemPattern: '*_cobertura.xml'
+ targetPath: $(Build.SourcesDirectory)
+
+ # This downloads Ubuntu_cobertura.xml from Ubuntu_CodeCoverageResults artifact to the root of the repo
+ - task: DownloadPipelineArtifact@2
+ displayName: Download Ubuntu code coverage reports
inputs:
- artifactName: CodeCoverageResults
- downloadPath: $(System.DefaultWorkingDirectory)
+ buildType: 'current'
+ artifactName: Ubuntu_CodeCoverageResults
+ itemPattern: '*_cobertura.xml'
+ targetPath: $(Build.SourcesDirectory)
+ # Merge the downloaded files (Windows_cobertura.xml and Ubuntu_cobertura.xml) as one (merged.cobertura.xml)
- script: $(Build.SourcesDirectory)/.dotnet/dotnet dotnet-coverage merge
- $(System.DefaultWorkingDirectory)/CodeCoverageResults/*.cobertura.xml
+ $(Build.SourcesDirectory)/*_cobertura.xml
--output-format cobertura
- --output ./merged.cobertura.xml
+ --output $(Build.SourcesDirectory)/merged.cobertura.xml
displayName: Merge code coverage reports
- script: $(Build.SourcesDirectory)/.dotnet/dotnet reportgenerator
- -reports:./merged.cobertura.xml
+ -reports:$(Build.SourcesDirectory)/merged.cobertura.xml
-targetdir:./CoverageResultsHtml
-reporttypes:HtmlInline_AzurePipelines
displayName: Generate code coverage report
@@ -23,12 +37,12 @@ steps:
DISABLE_COVERAGE_AUTOGENERATE: 'true'
inputs:
codeCoverageTool: cobertura
- summaryFileLocation: ./merged.cobertura.xml
+ summaryFileLocation: $(Build.SourcesDirectory)/merged.cobertura.xml
pathToSources: $(Build.SourcesDirectory)
reportDirectory: ./CoverageResultsHtml
- pwsh: |
- $(Build.SourcesDirectory)/eng/scripts/ValidateProjectCoverage.ps1 -CoberturaReportXml ./merged.cobertura.xml
+ $(Build.SourcesDirectory)/eng/scripts/ValidateProjectCoverage.ps1 -CoberturaReportXml $(Build.SourcesDirectory)/merged.cobertura.xml
displayName: Check per-project coverage
- ${{ if and(eq(variables['System.TeamProject'], 'public'), eq(variables['Build.Reason'], 'PullRequest')) }}:
@@ -39,3 +53,4 @@ steps:
repositoryName: '$(Build.Repository.Name)'
id: $(System.PullRequest.PullRequestNumber)
displayName: Report coverage to GitHub
+ continueOnError: 'true' # Avoid failing the build if the GitHub comment posting failed
diff --git a/test/Libraries/Microsoft.Extensions.Http.Diagnostics.Tests/Microsoft.Extensions.Http.Diagnostics.Tests.csproj b/test/Libraries/Microsoft.Extensions.Http.Diagnostics.Tests/Microsoft.Extensions.Http.Diagnostics.Tests.csproj
index a2d00f2e67f..c7993af2b52 100644
--- a/test/Libraries/Microsoft.Extensions.Http.Diagnostics.Tests/Microsoft.Extensions.Http.Diagnostics.Tests.csproj
+++ b/test/Libraries/Microsoft.Extensions.Http.Diagnostics.Tests/Microsoft.Extensions.Http.Diagnostics.Tests.csproj
@@ -26,6 +26,7 @@
+