Bitbucket Pipelines
Erode analyzes Bitbucket pull 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-bitbucket.sh, which handles model cloning and PR URL construction automatically:
pipelines: pull-requests: '**': - step: name: erode image: ghcr.io/erode-app/erode:0 script: - /entrypoint-bitbucket.sh variables: BITBUCKET_TOKEN: $BITBUCKET_TOKEN ANTHROPIC_API_KEY: $ANTHROPIC_API_KEY ERODE_MODEL_REPO: 'workspace/architecture-model'Environment variables
Section titled “Environment variables”| Variable | Required | Default | Description |
|---|---|---|---|
BITBUCKET_TOKEN | Yes | App password or repository/workspace access token | |
GEMINI_API_KEY, OPENAI_API_KEY, or ANTHROPIC_API_KEY | Yes | AI provider API key | |
AI_PROVIDER | No | anthropic | gemini, openai, or anthropic |
ERODE_MODEL_REPO | No | Model repository path (e.g. workspace/architecture-model) | |
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 | $BITBUCKET_TOKEN | Separate token for model repository access |
ERODE_OPEN_PR | No | false | Create PR 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 |
BITBUCKET_BASE_URL | No | https://api.bitbucket.org/2.0 | For self-hosted Bitbucket Data Center/Server instances |
Calling the CLI directly
Section titled “Calling the CLI directly”If you prefer more control, call the CLI directly instead of using the entrypoint:
pipelines: pull-requests: '**': - step: name: erode image: ghcr.io/erode-app/erode:0 script: - > node /app/packages/core/dist/ci-entry.js analyze ./model --url "https://bitbucket.org/${BITBUCKET_WORKSPACE}/${BITBUCKET_REPO_SLUG}/pull-requests/${BITBUCKET_PR_ID}" --format json --comment --fail-on-violations variables: BITBUCKET_TOKEN: $BITBUCKET_TOKEN ANTHROPIC_API_KEY: $ANTHROPIC_API_KEYCloning model from a separate repository
Section titled “Cloning model from a separate repository”pipelines: pull-requests: '**': - step: name: erode image: ghcr.io/erode-app/erode:0 script: - git clone --depth 1 "https://x-token-auth:${BITBUCKET_TOKEN}@bitbucket.org/workspace/architecture-model.git" /tmp/model - > node /app/packages/core/dist/ci-entry.js analyze /tmp/model --url "https://bitbucket.org/${BITBUCKET_WORKSPACE}/${BITBUCKET_REPO_SLUG}/pull-requests/${BITBUCKET_PR_ID}" --format json --comment variables: BITBUCKET_TOKEN: $BITBUCKET_TOKEN ANTHROPIC_API_KEY: $ANTHROPIC_API_KEYIf your token is an app password (username:app_password format), use it directly in the clone URL instead of x-token-auth:${BITBUCKET_TOKEN}.
Self-hosted Bitbucket
Section titled “Self-hosted Bitbucket”Set BITBUCKET_BASE_URL to point at your Data Center or Server instance:
variables: BITBUCKET_BASE_URL: https://bitbucket.example.com/rest/api/1.0Platform detection identifies bitbucket.org from PR URLs. Self-hosted Bitbucket instances require BITBUCKET_BASE_URL and the full PR URL passed via --url.
See Configuration for all environment variables and Self-Hosted for other deployment options.