-
Notifications
You must be signed in to change notification settings - Fork 10
GitLab CI CD
Using CodeFox with GitLab CI/CD
Example workflow
Choose one option:
Best for quick setup.variables:
CODEFOX_BRANCH: "v1.0.0"
stages:
- review
include:
- remote: "https://raw.githubusercontent.com/codefox-lab/CodeFox-CLI/refs/tags/v0.4.5-alpha/codefox-template.yml"
variables:
CODEFOX_BRANCH: "main"
stages:
- review
include:
- local: ".gitlab/codefox-template.yml"
First, in your project repository, run:
codefox init
This command will:
- generate the required configuration files (
.codefox.ymland.codefoxignore) - prepare the project for CodeFox analysis
Alternatively, you can manually add these files to your repository.
Do not commit the .codefoxenv file to your repository.
During initialization, the CLI will automatically and securely create .codefoxenv and store all required credentials inside it. This file is intended to remain local and must not be version-controlled.
After adding .codefox.yml and .codefoxignore to your repository, you need to configure access for CodeFox.
Go to:
Settings → Access Tokens
Click Add new token.
alt
alt
Fill in the following:
-
Name - any descriptive name (e.g.
codefox) - Expiration date - optional
-
Role -
DeveloperorReporter -
Scopes:
apiread_repositorywrite_repository
These permissions are required so CodeFox can:
- read repository data for analysis
- post comments to merge requests
After creating the token, copy it - you will not be able to see it again.
Go to:
Settings → CI/CD → Variables
Click Add variable.
alt
alt
Add the following variables:
-
GITLAB_TOKEN
Value: your Personal Access Token created earlier -
CODEFOX_API_KEY
Value: your CodeFox API key
These variables are used to:
- authenticate with GitLab
- connect CodeFox to the AI service
alt
After completing these steps, CodeFox will be able to:
- access your repository
- analyze merge requests
- post review results directly into MR comments