@@ -99,14 +99,25 @@ stages:
9999 image : ADO-MMS22-CodeCov
100100 pool : ${{ parameters.defaultPoolName }}
101101 targetFrameworks : ${{ parameters.codeCovTargetFrameworks }}
102- # This is a Pipeline Variable defined in the Azure DevOps UI. It
103- # must be defined with a true/false value for all pipelines that
104- # specify a build type of 'Project'.
102+ # We only want to upload coverage results to CodeCov from certain
103+ # pipelines. We use the pipeline name (Build.DefinitionName) to
104+ # choose. This is a predefined variable that is available at
105+ # template expansion time, so we can use it to supply a true boolean
106+ # value to the upload parameter.
105107 #
106- # You can find Pipeline Variables by visiting the main page of the
107- # pipeline and choosing Edit -> Variables.
108+ # https://learn.microsoft.com/en-us/azure/devops/pipelines/build/variables?view=azure-devops&tabs=yaml#build-variables-devops-services
108109 #
109- upload : $( eq(variables.ci_var_uploadTestResult, 'true') )
110+ # We're choosing to upload from these pipelines only:
111+ #
112+ # - PR-SqlClient-Project
113+ # - CI-SqlClient
114+ #
115+ # Other pipelines that share this template and use a Project
116+ # buildType don't add much, if any, value to the coverage reports.
117+ # They have not been configured with suitable CodeCov credentials to
118+ # perform the upload.
119+ #
120+ upload : ${{ or(eq(variables['Build.DefinitionName'], 'PR-SqlClient-Project'), eq(variables['Build.DefinitionName'], 'CI-SqlClient')) }}
110121
111122# test stages configurations
112123 # self hosted SQL Server on Windows
0 commit comments