Overview
This document shows how to use the CodeAnt Quality Gates pipe in your Bitbucket pipelines. Reference Repository: quality-gates-codeantPrerequisites
Before using the pipe, configure these repository variables in Repository Settings → Pipelines → Repository variables:BITBUCKET_ACCESS_TOKEN
- Your Bitbucket access token (App password or repository access token)
Basic Usage
Example 1: Run Quality Gates on Every Push
Example 2: Run Quality Gates on Pull Requests Only
Example 3: Run Quality Gates with Custom Configuration
Example 4: Multi-Stage Pipeline with Quality Gates
Example 5: Quality Gates with Debug Mode
Configuration Variables
Variable | Required | Default | Description |
---|---|---|---|
ACCESS_TOKEN | Yes | - | CodeAnt access token for authentication |
API_BASE | No | https://api.codeant.ai | Base URL for CodeAnt API |
TIMEOUT | No | 300 | Maximum time in seconds to wait for results |
POLL_INTERVAL | No | 15 | Time in seconds between polling attempts |
DEBUG | No | false | Enable debug mode for verbose logging |
How It Works
- The pipe fetches the quality gates script from the CodeAnt API
- It initiates a quality gate scan for your repository and commit
- It polls for results until the scan completes or times out
- If secrets or issues are detected, the pipeline fails
- If the quality gate passes, the pipeline continues
Execution Time Considerations
⏱️ Performance Options:-
Default behavior (with result waiting): ~5-7 minutes
- Triggers scan and waits for complete analysis results
- Provides immediate feedback on secrets and security issues
- Best for comprehensive CI/CD pipelines where you need instant validation
-
Custom timeout settings: Adjust based on repository size
- Use
TIMEOUT: "600"
(10 minutes) for larger repositories - Use
POLL_INTERVAL: "20"
to reduce API polling frequency - Results can also be viewed in the CodeAnt dashboard
- Use
Troubleshooting
Pipeline Fails Immediately
Issue: Pipeline fails with “ACCESS_TOKEN is required but not set” Solution: Ensure you’ve setBITBUCKET_ACCESS_TOKEN
in your repository variables.
Pipeline Times Out
Issue: Pipeline times out waiting for results Solution: Increase theTIMEOUT
variable:
Connection Issues
Issue: Cannot connect to CodeAnt API Solution: Verify theAPI_BASE
URL and check if you need to use a custom endpoint:
Support
- 📧 Email: support@codeant.ai
- 📚 Documentation: https://docs.codeant.ai
- 🐛 Repository: https://bitbucket.org/codeantworkspace/quality-gates-codeant/src/main/