iwantcoding.com
🔥 Daily 👥 Rooms 🏆 Top Log in Sign up

Bitbucket

Bitbucket is Atlassian-flavoured Git hosting - tight integration with Jira, Trello, and Confluence. Smaller market share than GitHub but common in enterprise.

Bitbucket - production setup

EXAMPLE
# 1. Pull request (PR) workflow
git checkout -b feat/login-form
# ... edit, commit, push ...
# Push prints a URL to open the PR; or use the bb CLI:
# brew install bb
bb pr create --title 'feat: login form' --branch main


# 2. Branch permissions (admin -> Repository settings -> Branch restrictions)
# - main: prevent direct push
# - require at least N approvals
# - require successful build (BB Pipelines)
# - prevent rewinding (force push)
# - default reviewers (CODEOWNERS analogue)


# 3. CODEOWNERS analogue
# Bitbucket Cloud calls this 'Default reviewers'.
# For Bitbucket Data Center: CODEOWNERS file with a plugin


# 4. Bitbucket Pipelines - .bitbucket-pipelines.yml
image: node:20

pipelines:
  default:
    - step:
        name: Lint + Test
        caches: [ node ]
        script:
          - npm ci
          - npm run lint
          - npm test -- --coverage

  branches:
    main:
      - step:
          name: Build + Deploy
          deployment: production
          caches: [ node ]
          script:
            - npm ci
            - npm run build
            - pipe: atlassian/aws-s3-deploy:1.0.0
              variables:
                AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
                AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
                AWS_DEFAULT_REGION: ap-southeast-2
                S3_BUCKET: my-static-site
                LOCAL_PATH: dist


# 5. Repository variables + deployments
# Repo settings -> Repository variables -> add as Secured for secrets
# Deployments group variables by environment (test / staging / production)


# 6. Jira links
# Include the issue key in PR title or branch:
git checkout -b PROJ-123-login-form
# PR titles like 'PROJ-123: Login form' auto-link in Jira


# 7. Snippets, Wiki, and Issues are built in
# For larger teams, Jira + Confluence is the typical pair


# 8. Bitbucket Pipelines tips
# - Set max-time per step
# - Use caches: aggressively
# - Use pipes (Atlassian's reusable steps) for common deploy targets
# - Define deployments to get UI-driven environment promotion

# Useful CLI
# bb pr list, bb pr view <id>, bb pipeline run

# CODEOWNERS in Data Center
# Install the 'Code Owners for Bitbucket' app; same syntax as GitHub's CODEOWNERS

Why it matters

Bitbucket Pipelines is integrated and easy; for complex needs, GitHub Actions or GitLab CI have more momentum. The strongest Bitbucket workflow is Jira-aware branch naming + default reviewers + branch restrictions on main.

Tip: Tweak the snippet with Try it Yourself », then sit the quiz at the bottom of the page.

Example

Example
# Bitbucket: tight Jira integration, pipelines.
bb repo create my-app
Try it Yourself »

Discussion

Loading…