GitLab CI
Erode analyzes GitLab merge requests using the same Docker image published for the GitHub Action.
Using the Docker image
Section titled “Using the Docker image”The image includes entrypoint-gitlab.sh, which handles model cloning and MR URL construction automatically:
erode: image: ghcr.io/erode-app/erode:0 entrypoint: ['/entrypoint-gitlab.sh'] rules: - if: $CI_MERGE_REQUEST_IID variables: ERODE_GITLAB_TOKEN: $GITLAB_API_TOKEN ERODE_ANTHROPIC_API_KEY: $ANTHROPIC_API_KEY ERODE_MODEL_REPO: 'group/architecture-model'Environment variables
Section titled “Environment variables”| Variable | Required | Default | Description |
|---|---|---|---|
ERODE_GITLAB_TOKEN | Yes | GitLab API token with api scope | |
ERODE_GEMINI_API_KEY, ERODE_OPENAI_API_KEY, or ERODE_ANTHROPIC_API_KEY | Yes | AI provider API key | |
ERODE_AI_PROVIDER | No | anthropic | gemini, openai, or anthropic |
ERODE_MODEL_REPO | No | Model repository path (e.g. group/architecture-model). Omit if the model is in the same repo | |
ERODE_MODEL_PATH | No | . | Path to model within the repository |
ERODE_MODEL_REF | No | main | Git ref for the model repository |
ERODE_MODEL_FORMAT | No | likec4 | Architecture model format (likec4 or structurizr) |
ERODE_MODEL_REPO_TOKEN | No | $ERODE_GITLAB_TOKEN | Separate token for model repository access |
ERODE_OPEN_PR | No | false | Create MR with suggested model updates |
ERODE_FAIL_ON_VIOLATIONS | No | false | Exit with code 1 when violations are found |
ERODE_SKIP_FILE_FILTERING | No | false | Analyze all changed files |
ERODE_GITLAB_BASE_URL | No | https://gitlab.com | For self-hosted GitLab instances |
Calling the CLI directly
Section titled “Calling the CLI directly”If you prefer more control, disable the default entrypoint and call the CLI:
erode: image: ghcr.io/erode-app/erode:0 entrypoint: [''] script: - > node /app/packages/core/dist/ci-entry.js analyze ./model --url "$CI_PROJECT_URL/-/merge_requests/$CI_MERGE_REQUEST_IID" --format json --comment --fail-on-violations rules: - if: $CI_MERGE_REQUEST_IID variables: ERODE_GITLAB_TOKEN: $GITLAB_API_TOKEN ERODE_ANTHROPIC_API_KEY: $ANTHROPIC_API_KEYCloning model from a separate repository
Section titled “Cloning model from a separate repository”erode: image: ghcr.io/erode-app/erode:0 entrypoint: [''] script: - git clone --depth 1 "https://gitlab-ci-token:${ERODE_GITLAB_TOKEN}@gitlab.com/group/architecture-model.git" /tmp/model - > node /app/packages/core/dist/ci-entry.js analyze /tmp/model --url "$CI_PROJECT_URL/-/merge_requests/$CI_MERGE_REQUEST_IID" --format json --comment rules: - if: $CI_MERGE_REQUEST_IID variables: ERODE_GITLAB_TOKEN: $GITLAB_API_TOKEN ERODE_ANTHROPIC_API_KEY: $ANTHROPIC_API_KEYSelf-hosted GitLab
Section titled “Self-hosted GitLab”Set ERODE_GITLAB_BASE_URL to point at your instance:
variables: ERODE_GITLAB_BASE_URL: https://gitlab.example.comPlatform detection identifies github.com and gitlab.com from PR/MR URLs. Self-hosted GitLab instances require ERODE_GITLAB_BASE_URL and the full MR URL passed via --url.
See Configuration for all environment variables and Self-Hosted for other deployment options.