Installation
Before using CodeAnt Coverage Upload in your Azure Pipelines, you need to install the CodeAnt extension from the Azure DevOps Marketplace:- Go to the Azure DevOps Marketplace and search for “CodeAnt AI” or directly download from here
- Click Get it free
- Select your Azure DevOps organization
- Click Install
CodeAntCoverageUpload@1 task will be available in all pipelines across your organization.
Video Tutorial
Watch this video to learn how to integrate CodeAnt AI into your CI/CD pipelines:Repository Scenarios
CodeAnt Coverage Upload supports multiple repository configurations in Azure DevOps:Scenario 1: Azure Repos + Azure DevOps Pipeline
For Azure Repos in Azure DevOps Services:azure-pipelines.yml
Note: The task automatically extracts repository information from these Azure DevOps built-in variables:
SYSTEM_TEAMPROJECT- Project nameBUILD_REPOSITORY_NAME- Repository nameBUILD_SOURCEVERSION- Commit SHA
Job token permissions
The job’s Build Service identity needs Read access to the repository. See Azure Pipelines job token permissions.Use a CodeAnt token as a fallback
If the built-in token is unavailable, create a CodeAnt token with the Codeant CI/CD role and repository access. Save it as a secret pipeline variable namedCODEANT_TOKEN and replace the input:
Scenario 2: Azure Repos (TFS / Azure DevOps Server – on-prem) + Azure DevOps Server (TFS) Pipeline
When your repository is hosted in an on-premise Azure DevOps Server (formerly known as Team Foundation Server / TFS), you need to explicitly pass all required parameters including the base URL.azure-pipelines.yml
Parameters for Azure DevOps Server (TFS)
Note: For on-premise Azure DevOps Server / TFS deployments, all parameters must be explicitly provided as environment variables may differ from Azure DevOps Cloud.
Scenario 3: GitHub Repository + Azure DevOps Pipeline
azure-pipelines.yml
Parameters for GitHub
Scenario 4: GitLab Repository + Azure DevOps Pipeline
azure-pipelines.yml
Parameters for GitLab
Scenario 5: Bitbucket Repository + Azure DevOps Pipeline
azure-pipelines.yml
Parameters for Bitbucket
Task Parameters Reference
Required Parameters
Optional Parameters
Azure DevOps Pipelines Workflow
This pipeline triggers on pushes to the specified branch and performs the following steps:- Runs tests and generates a coverage report
- Uploads the coverage XML to CodeAnt AI
azure-pipelines.yml
With Optional Parameters
You can customize the coverage upload with additional parameters:azure-pipelines.yml
Monorepo Support
For monorepo projects, you can specify themodule and modulePath parameters to track coverage for individual modules:
azure-pipelines.yml
Monorepo Parameters
Multiple Modules Example
For monorepos with multiple modules, give each upload its ownmodule and modulePath. CodeAnt AI keeps the reports separate so each module is tracked, displayed, and gated independently. Without module, every upload writes to the same key and later steps overwrite earlier ones.
Recommended: a single job with strategy.matrix
Instead of duplicating the upload step per module, define it once and fan it out with strategy.matrix. Each matrix entry becomes its own parallel job; adding a new module is one new entry.
azure-pipelines.yml
Coverage backend, Coverage frontend, etc. - and each runs the upload independently with its own module, modulePath, and coverageFile.
Alternative: one step per module
If you prefer the explicit form (e.g. each module has a different test command that can’t be parameterized cleanly), call the task once per module:azure-pipelines.yml
How it works
- Setup environment The task automatically extracts organization, project, and repository information from Azure DevOps built-in variables.
-
Download script
The task fetches the coverage upload script (
upload_coverage.sh) from the CodeAnt API endpoint. - Upload coverage The script uploads your coverage report to CodeAnt AI for analysis and tracking.
-
Pipeline feedback
- Success: Coverage uploaded successfully
- Failure: Upload fails due to authentication or file issues
Coverage Formats Supported
Important: Only XML format is supported for coverage reports.
- Cobertura XML (most common, generated by
coverage xml) - JaCoCo XML (Java projects)
Coverage Config File
You have to create a.coveragerc file in the project’s root folder to include all the source files in the test coverage calculation.
Python Example
.coveragerc
How it works
With the above configuration:- coverage run -m pytest tests/ will count every .py under the workspace as “valid” lines except for those in the omitted directories.
- Lines actually executed by your tests are marked “covered.”
- coverage xml -o coverage.xml produces a Cobertura-style report reflecting true coverage over the entire codebase.
- Using this coverage xml, we calculate the coverage percentage and the status check will be done on every new push to the branch.
Windows Runner Configuration
If you’re using Windows runner (windows-latest) instead of Linux runner, make the following change:
Change Required
Update pool configuration:azure-pipelines.yml
Key Difference
On-Premise Deployment
If you are using a self-hosted CodeAnt instance, you can specify a custom API endpoint using theapiBase parameter:
azure-pipelines.yml
Note: The apiBase parameter is only required for on-premise deployments. Cloud users do not need to configure this.
Authentication diagnostics
Version1.0.30 and later of the Marketplace extension logs the selected access token as first4********last4, together with the platform, repository, provider base URL, and whether Azure DevOps used a current or legacy cloud URL. The complete token is never printed.
If you see HTTP 401, HTTP 403, or “Access token invalid”:
- For Azure Repos in Azure DevOps Services, pass
accessToken: $(System.AccessToken)from the running job. - Check that the job’s Build Service identity has Read access to the target repository and that job authorization scope permits access. See job token permissions.
- If using
CODEANT_TOKEN, check that the secret variable resolves, the token is active, and its Codeant CI/CD role and repository scope cover the target repository. - Legacy
https://{organization}.visualstudio.com/collection URLs are automatically normalized. If the task logs a malformed repository path containinghttps:, update the Marketplace extension under Organization Settings → Extensions.
Token permission
If you authenticate with a CodeAnt API token (cdt_…) and the token is scoped, give it the Codeant CI/CD role - it covers scans, quality gates, and test-coverage upload - scoped to the repositories this pipeline runs on (or All repositories). A token missing the required permission is rejected with an HTTP 403 token_scope_forbidden error that names the permission it needs. See API token permissions.