CodeAnt CI Scan for GitLab
A GitLab CI/CD configuration to run CodeAnt security and code quality analysis on your repository.Features
- 🧠 Automated security and code quality scanning
- 🔍 Deep vulnerability and dependency analysis
- 📊 Comprehensive reports and actionable insights
- ⚡ Fast setup - integrate in under a minute
- 🔄 Supports push, merge requests, and default branch commits
Quick Start (Recommended)
Add this to your project’s.gitlab-ci.yml
file:
codeant_scan
job defined in the shared CodeAnt pipeline template.
Setup Guide
1. Get Your CodeAnt Access Token
- Sign up or log in to CodeAnt
- Navigate to your Account Settings > Personal Access Tokens
- Click Generate Token
- Copy the token
2. Add Token to GitLab CI/CD Variables
- Go to Settings > CI/CD > Variables
- Click Add Variable
- Fill in the details:
- Key:
ACCESS_TOKEN
- Value: your CodeAnt token
- Protect variable: Yes (Recommended)
- Mask variable: Yes (Recommended)
- Key:
- Click Add Variable
3. Commit and Push
Once your.gitlab-ci.yml
file includes the CodeAnt template, push it to your repository. Your next push, merge request, or main branch commit will automatically trigger a scan.
Advanced Usage
You can customize how CodeAnt scans your repository by overriding variables:Example Configurations
Scan on Push and Merge Requests (Default)
Scan Only on Main Branch and Merge Requests
Scheduled Daily Scan
Create a scheduled pipeline in CI/CD > Schedules and use:Scan Specific Directories
Using a Self-Hosted CodeAnt Instance
Increasing Scan Timeout
For large repositories that need more time to complete analysis:timeout: 15m
- GitLab CI job timeout (format: 30s, 5m, 1h, 2h 30m)SCAN_TIMEOUT: "600"
- CodeAnt scan timeout in seconds (default: 300)
- Samll repos (< 1000 files):
SCAN_TIMEOUT: "300"
(5 minutes) - Medium repos (1000-5000 files):
SCAN_TIMEOUT: "600"
(10 minutes) - Large repos (>5000 files):
SCAN_TIMEOUT: "900"
(15 minutes)
Multi-Stage Pipeline
Integrate CodeAnt scan with other pipeline stages:GitLab CI Variables Used
The configuration automatically uses these GitLab predefined variables:- CI_PROJECT_PATH - Full path of the repository (e.g., group/project)
- CI_COMMIT_SHA - The commit SHA being analyzed
- CI_COMMIT_REF_NAME - The branch or tag name
- CI_PIPELINE_SOURCE - The source of the pipeline trigger
- CI_DEFAULT_BRANCH - The default branch of the project
Troubleshooting
Authentication Errors- Ensure your
ACCESS_TOKEN
is correctly set in CI/CD variables - Verify the token hasn’t expired
- Check that the token has the necessary permissions
- Confirm the variable is available (not protected when running on non-protected branches)
- Verify your repository is accessible
- Check that the API base URL is correct
- Review the pipeline logs for specific error messages
- Ensure GitLab runners can access the CodeAnt API endpoint
- Verify the
API_BASE
URL is correct - Check network connectivity and firewall rules
- Ensure the CodeAnt API endpoint is accessible from your GitLab runners
- Check that
.gitlab-ci.yml
is in the repository root - Verify the
rules
section matches your intended triggers - Review CI/CD > Pipelines for error messages
- Validate the YAML syntax using GitLab’s CI Lint tool (CI/CD > Editor > Validate)
Support
- 📧 Email: support@codeant.ai
- 📚 Documentation: https://docs.codeant.ai
- 🐛 Issues: GitLab Issues
- 💬 GitLab CI/CD Docs: https://docs.gitlab.com/ee/ci/