diff --git a/eng/pipelines/common/templates/jobs/ci-code-coverage-job.yml b/eng/pipelines/common/templates/jobs/ci-code-coverage-job.yml index 76a9b07939..170a4d52a2 100644 --- a/eng/pipelines/common/templates/jobs/ci-code-coverage-job.yml +++ b/eng/pipelines/common/templates/jobs/ci-code-coverage-job.yml @@ -33,7 +33,6 @@ parameters: # True to upload code coverage results to CodeCov. - name: upload type: boolean - default: true jobs: - job: CodeCoverage diff --git a/eng/pipelines/dotnet-sqlclient-ci-core.yml b/eng/pipelines/dotnet-sqlclient-ci-core.yml index 7fac4ad14a..a4c9ecf118 100644 --- a/eng/pipelines/dotnet-sqlclient-ci-core.yml +++ b/eng/pipelines/dotnet-sqlclient-ci-core.yml @@ -99,6 +99,25 @@ stages: image: ADO-MMS22-CodeCov pool: ${{ parameters.defaultPoolName }} targetFrameworks: ${{ parameters.codeCovTargetFrameworks }} + # We only want to upload coverage results to CodeCov from certain + # pipelines. We use the pipeline name (Build.DefinitionName) to + # choose. This is a predefined variable that is available at + # template expansion time, so we can use it to supply a true boolean + # value to the upload parameter. + # + # https://learn.microsoft.com/en-us/azure/devops/pipelines/build/variables?view=azure-devops&tabs=yaml#build-variables-devops-services + # + # We're choosing to upload from these pipelines only: + # + # - PR-SqlClient-Project + # - CI-SqlClient + # + # Other pipelines that share this template and use a Project + # buildType don't add much, if any, value to the coverage reports. + # They have not been configured with suitable CodeCov credentials to + # perform the upload. + # + upload: ${{ or(eq(variables['Build.DefinitionName'], 'PR-SqlClient-Project'), eq(variables['Build.DefinitionName'], 'CI-SqlClient')) }} # test stages configurations # self hosted SQL Server on Windows