1
bb how to integrate
Alexey Efimchik edited this page 2026-04-02 10:48:12 +07:00

🔌 CI/CD Integration for Bitbucket VCS

📖 Introduction

Manually launching and configuring the tool is quite a challenging task and requires a deep understanding of the AI service being used and the built-in operating rules. Therefore, to simplify the task, we have created pre-prepared actions for launching and updating the tool.

👤 1. User for review

For the tool to work, you need to add a user who will perform the review. Add user as the default reviewer for repository if you want it to be assigned automatically, or add it manually if necessary.

Use this Bitbucket user by default: @kodobot.

📄 2. Prepared step script for Bitbucket

Use the following script to integrate the tool into your Bitbucket pipelines. All necessary improvements and integrations must be performed independently by each team. Consider using Parallel steps in pipelines. Update your bitbucket-pipelines.yml file by adding the following:

AR.NET Team

definitions:
  steps:
    - step: &ai-review-step
        clone:
          depth: full
        name: AI Code Review
        max-time: 40
        image: code.wynenterprise.io/docker/bitbucket-ai-review:ar
        runs-on: [kodo]
        script:
          - |
            COMMIT_MSG=$(git log --format=%B -n 1 "$BITBUCKET_COMMIT")

            if [[ "$COMMIT_MSG" == *"[no ai]"* ]]; then
              echo "Skip pipeline: [no ai] found in commit message."
              exit 0
            fi

            export VCS_ACCESS_TOKEN=$CC_KODOTOKEN
            export ATLASSIAN_USER_EMAIL=$CC_KODOMAIL
            export TEAM_NAME=$CC_TEAM

            /pipe.sh

pipelines:
  pull-requests:
    '**':
      - step: *ai-review-step

  custom:
    ai-review:
      - step: *ai-review-step

ARJS Team

definitions:
  steps:
    - step: &ai-review-step
        clone:
          depth: full
        name: AI Code Review
        max-time: 40
        image: code.wynenterprise.io/docker/bitbucket-ai-review:arjs
        runs-on: [kodo]
        script:
          - |
            COMMIT_MSG=$(git log --format=%B -n 1 "$BITBUCKET_COMMIT")

            if [[ "$COMMIT_MSG" == *"[no ai]"* ]]; then
              echo "Skip pipeline: [no ai] found in commit message."
              exit 0
            fi

            export VCS_ACCESS_TOKEN=$CC_KODOTOKEN
            export ATLASSIAN_USER_EMAIL=$CC_KODOMAIL
            export TEAM_NAME=$CC_TEAM

            /pipe.sh

pipelines:
  pull-requests:
    '**':
      - step: *ai-review-step

  custom:
    ai-review:
      - step: *ai-review-step

C1 Team

definitions:
  steps:
    - step: &ai-review-step
        clone:
          depth: full
        name: AI Code Review
        max-time: 40
        image: code.wynenterprise.io/docker/bitbucket-ai-review:c1
        runs-on: [kodo]
        script:
          - |
            COMMIT_MSG=$(git log --format=%B -n 1 "$BITBUCKET_COMMIT")

            if [[ "$COMMIT_MSG" == *"[no ai]"* ]]; then
              echo "Skip pipeline: [no ai] found in commit message."
              exit 0
            fi

            export VCS_ACCESS_TOKEN=$CC_KODOTOKEN
            export ATLASSIAN_USER_EMAIL=$CC_KODOMAIL
            export TEAM_NAME=$CC_TEAM

            /pipe.sh

pipelines:
  pull-requests:
    '**':
      - step: *ai-review-step

  custom:
    ai-review:
      - step: *ai-review-step

This script will run automatically when a Pull Request is created or updated. If necessary, you can start it manually via the Bitbucket interface and add additional conditions required for start.

⚠️ Important! All pre-built scripts include a custom ai-review step. Do not change this name.