Skip to content

Bitbucket Pipelines

Erode analyzes Bitbucket pull requests using the same Docker image published for the GitHub Action.

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'
VariableRequiredDefaultDescription
BITBUCKET_TOKENYesApp password or repository/workspace access token
GEMINI_API_KEY, OPENAI_API_KEY, or ANTHROPIC_API_KEYYesAI provider API key
AI_PROVIDERNoanthropicgemini, openai, or anthropic
ERODE_MODEL_REPONoModel repository path (e.g. workspace/architecture-model)
ERODE_MODEL_PATHNo.Path to model within the repository
ERODE_MODEL_REFNomainGit ref for the model repository
ERODE_MODEL_FORMATNolikec4Architecture model format (likec4 or structurizr)
ERODE_MODEL_REPO_TOKENNo$BITBUCKET_TOKENSeparate token for model repository access
ERODE_OPEN_PRNofalseCreate PR with suggested model updates
ERODE_FAIL_ON_VIOLATIONSNofalseExit with code 1 when violations are found
ERODE_SKIP_FILE_FILTERINGNofalseAnalyze all changed files
BITBUCKET_BASE_URLNohttps://api.bitbucket.org/2.0For self-hosted Bitbucket Data Center/Server instances

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_KEY
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_KEY

If your token is an app password (username:app_password format), use it directly in the clone URL instead of x-token-auth:${BITBUCKET_TOKEN}.

Set BITBUCKET_BASE_URL to point at your Data Center or Server instance:

variables:
BITBUCKET_BASE_URL: https://bitbucket.example.com/rest/api/1.0

Platform 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.