### Create a new repository with Sourcetree Source: https://support.atlassian.com/bitbucket-cloud/docs/build-test-and-deploy-with-pipelines/index Get started with Sourcetree by learning how to create a new Git repository. This covers the initial setup and configuration within the Sourcetree application. -------------------------------- ### Create a project in Bitbucket Cloud Source: https://support.atlassian.com/bitbucket-cloud/docs/build-test-and-deploy-with-pipelines/index Step-by-step guide on creating a new project in Bitbucket Cloud, including initial setup and configuration. -------------------------------- ### Javascript (Node.js) with Bitbucket Pipelines Source: https://support.atlassian.com/bitbucket-cloud/docs/build-test-and-deploy-with-pipelines/index Learn how to set up and run Node.js projects in Bitbucket Pipelines. This includes installing dependencies, running tests, and building your JavaScript application. ```YAML pipelines: default: - step: name: Node.js build and test image: node:18 script: - npm install - npm test - npm run build ``` -------------------------------- ### PHP with Bitbucket Pipelines Source: https://support.atlassian.com/bitbucket-cloud/docs/build-test-and-deploy-with-pipelines/index Instructions for using Bitbucket Pipelines with PHP projects. This includes setting up the PHP environment, installing Composer dependencies, and running PHPUnit tests. ```YAML pipelines: default: - step: name: PHP build and test image: php:8.1 script: - composer install - vendor/bin/phpunit ``` -------------------------------- ### Copy your Git repository and add files Source: https://support.atlassian.com/bitbucket-cloud/docs/build-test-and-deploy-with-pipelines/index Understand how to clone an existing Git repository and add new files to it. This process is essential for starting new projects or contributing to existing ones. ```bash git clone ``` ```bash git add ``` -------------------------------- ### Java with Bitbucket Pipelines Source: https://support.atlassian.com/bitbucket-cloud/docs/build-test-and-deploy-with-pipelines/index This guide details how to configure Bitbucket Pipelines for Java projects. It covers setting up the Java environment, managing dependencies with tools like Maven or Gradle, and executing build and test commands. ```YAML pipelines: default: - step: name: Java build and test image: maven:3.8-openjdk-11 script: - mvn clean install ``` -------------------------------- ### SSH Key Setup for Bitbucket Source: https://support.atlassian.com/bitbucket-cloud/docs/build-test-and-deploy-with-pipelines/index Instructions for setting up SSH keys on different operating systems (macOS, Windows, Linux) to securely access Bitbucket repositories. This includes generating keys, adding them to Bitbucket, and managing multiple keys on a single device. ```bash # Generate SSH key on macOS/Linux ssh-keygen -t rsa -b 4096 -C "your_email@example.com" # Add SSH key to the ssh-agent eval "$(ssh-agent -s)" ssh-add ~/.ssh/id_rsa # Copy the public key to clipboard cat ~/.ssh/id_rsa.pub | pbcopy ``` ```powershell # Generate SSH key on Windows ssh-keygen -t rsa -b 4096 -C "your_email@example.com" # Copy the public key to clipboard Get-Content $env:USERPROFILE\.ssh\id_rsa.pub | Set-Clipboard ``` -------------------------------- ### Git LFS Configuration for Bitbucket Source: https://support.atlassian.com/bitbucket-cloud/docs/build-test-and-deploy-with-pipelines/index Guidance on using Git Large File Storage (LFS) with Bitbucket Cloud, including initial setup, migrating existing repositories, understanding limitations, and managing storage policies. ```bash # Install Git LFS git lfs install # Track large files git lfs track "*.psd" git add .gitattributes # Commit and push git add large_file.psd git commit -m "Add large PSD file" git push origin ``` -------------------------------- ### Use SSH Keys in Bitbucket Pipelines Source: https://support.atlassian.com/bitbucket-cloud/docs/build-test-and-deploy-with-pipelines/index This section covers setting up and using SSH keys within Bitbucket Pipelines for secure access to repositories or external services. It includes platform-specific setup instructions. ```YAML pipelines: default: - step: name: SSH key setup script: - apt-get update && apt-get install -y openssh-client - eval "$(ssh-agent -s)" - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - - mkdir -p ~/.ssh - chmod 700 ~/.ssh - echo "$SSH_KNOWN_HOSTS" >> ~/.ssh/known_hosts - chmod 644 ~/.ssh/known_hosts ``` -------------------------------- ### Configure Runners in bitbucket-pipelines.yml Source: https://support.atlassian.com/bitbucket-cloud/docs/build-test-and-deploy-with-pipelines/index This guide explains how to configure self-hosted runners for Bitbucket Pipelines directly within the `bitbucket-pipelines.yml` file, specifying the runner type and any necessary configurations. ```YAML pipelines: default: - step: name: Run on specific runner runner: name: my-linux-runner script: - echo "Running on a specific runner" ``` -------------------------------- ### Deploy to AWS S3 with Bitbucket Pipelines Source: https://support.atlassian.com/bitbucket-cloud/docs/build-test-and-deploy-with-pipelines/index This guide explains how to deploy build artifacts to AWS S3 using Bitbucket Pipelines. It typically involves configuring AWS credentials and using the AWS CLI or specific pipes. ```YAML pipelines: branches: main: - step: name: Deploy to S3 script: - pipe: atlassian/aws-s3-deploy:1.1.0 variables: AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY AWS_DEFAULT_REGION: 'us-east-1' S3_BUCKET: 'my-s3-bucket' LOCAL_PATH: 'dist' ``` -------------------------------- ### Create a repository and add a reviewer Source: https://support.atlassian.com/bitbucket-cloud/docs/build-test-and-deploy-with-pipelines/index Learn the initial steps for creating a repository and setting up a reviewer for pull requests. This is crucial for code review processes. -------------------------------- ### Create a Git repository Source: https://support.atlassian.com/bitbucket-cloud/docs/build-test-and-deploy-with-pipelines/index Learn the basic steps to create a new Git repository, a fundamental operation for version control. This tutorial covers initializing a repository locally. ```bash git init ``` -------------------------------- ### Copy your repository and add files with Sourcetree Source: https://support.atlassian.com/bitbucket-cloud/docs/build-test-and-deploy-with-pipelines/index Learn how to clone existing repositories and add new files using Sourcetree. This provides a visual way to manage your Git workflow. -------------------------------- ### Webhooks for Bitbucket Source: https://support.atlassian.com/bitbucket-cloud/docs/build-test-and-deploy-with-pipelines/index Information on creating and triggering webhooks in Bitbucket Cloud to automate actions based on repository events. This includes understanding event payloads and setting up webhook URLs. ```json { "callbackUrl": "https://example.com/webhook-receiver", "events": [ "repo:push", "pullrequest:created" ], "description": "My custom webhook" } ``` -------------------------------- ### Ruby with Bitbucket Pipelines Source: https://support.atlassian.com/bitbucket-cloud/docs/build-test-and-deploy-with-pipelines/index Learn how to use Bitbucket Pipelines for Ruby projects. This includes setting up the Ruby environment, managing gems with Bundler, and running RSpec tests. ```YAML pipelines: default: - step: name: Ruby build and test image: ruby:3.0 script: - bundle install - bundle exec rspec ``` -------------------------------- ### Configure Bitbucket Pipelines YAML Source: https://support.atlassian.com/bitbucket-cloud/docs/build-test-and-deploy-with-pipelines/index This snippet demonstrates basic configuration options for the `bitbucket-pipelines.yml` file, including global options, Git clone behavior, and Docker image settings. ```YAML image: python:3.9 pipelines: default: - step: script: - echo "Running default pipeline" ``` -------------------------------- ### Git Commands for Bitbucket Source: https://support.atlassian.com/bitbucket-cloud/docs/build-test-and-deploy-with-pipelines/index This section covers essential Git commands for version control operations within Bitbucket Cloud. It includes commands for initializing, cloning, committing, pushing, and pulling code, as well as managing branches and pull requests. ```bash git init git clone git add . git commit -m "Commit message" git push origin git pull origin git checkout git merge ``` -------------------------------- ### Clone and make a change on a new branch Source: https://support.atlassian.com/bitbucket-cloud/docs/build-test-and-deploy-with-pipelines/index This tutorial covers cloning a repository, creating a new branch, and making modifications to files within that branch. ```bash git clone ``` ```bash git checkout -b ``` ```bash # Make your changes here ``` -------------------------------- ### Python with Bitbucket Pipelines Source: https://support.atlassian.com/bitbucket-cloud/docs/build-test-and-deploy-with-pipelines/index This section provides guidance on integrating Python projects with Bitbucket Pipelines. It covers setting up Python environments, managing packages with pip, and running tests. ```YAML pipelines: default: - step: name: Python build and test image: python:3.9 script: - pip install -r requirements.txt - python -m pytest ``` -------------------------------- ### Bitbucket Pipelines Configuration Reference Source: https://support.atlassian.com/bitbucket-cloud/docs/build-test-and-deploy-with-pipelines/index This snippet refers to the complete configuration reference for the Bitbucket Pipelines bitbucket-pipelines.yml file. It details the structure and options available for defining CI/CD workflows. ```yaml # Example of bitbucket-pipelines.yml structure # pipelines: # default: # - step: # name: Build and Test # script: # - echo "Building and testing..." # - mvn clean install # branches: # main: # - step: # name: Deploy to Production # script: # - echo "Deploying to production..." # - ./deploy.sh ``` -------------------------------- ### Configure a project's branching model Source: https://support.atlassian.com/bitbucket-cloud/docs/build-test-and-deploy-with-pipelines/index Set up and customize the branching strategy for your Bitbucket Cloud project. This includes defining main branches and merge workflows. -------------------------------- ### Add repositories to a project Source: https://support.atlassian.com/bitbucket-cloud/docs/build-test-and-deploy-with-pipelines/index Learn how to associate existing or new repositories with a specific project in Bitbucket Cloud for better organization and management. -------------------------------- ### Set up Project Access keys on Windows Source: https://support.atlassian.com/bitbucket-cloud/docs/build-test-and-deploy-with-pipelines/index Configure SSH keys for project access on Windows. This enables secure Git operations with your Bitbucket projects from a Windows environment. -------------------------------- ### Access Tokens for Bitbucket Source: https://support.atlassian.com/bitbucket-cloud/docs/build-test-and-deploy-with-pipelines/index Details on creating, managing, and revoking access tokens for both repository and workspace levels in Bitbucket Cloud. This includes understanding token permissions and expiry. ```bash # Example of creating a repository access token (conceptual) # This would typically be done via the Bitbucket UI or API # curl -X POST -u : https://api.bitbucket.org/2.0/repositories///api-keys ``` -------------------------------- ### Use Sourcetree branches to merge an update Source: https://support.atlassian.com/bitbucket-cloud/docs/build-test-and-deploy-with-pipelines/index Discover how to effectively use branches in Sourcetree for managing changes and merging them. This visual approach simplifies complex Git operations. -------------------------------- ### Set up Project Access keys on Linux Source: https://support.atlassian.com/bitbucket-cloud/docs/build-test-and-deploy-with-pipelines/index Configure SSH keys for project access on Linux. This provides secure authentication for Git operations on your Bitbucket projects. -------------------------------- ### Pull changes from your repository on Bitbucket with Sourcetree Source: https://support.atlassian.com/bitbucket-cloud/docs/build-test-and-deploy-with-pipelines/index Understand how to pull updates from your Bitbucket repository into your local Sourcetree client. This ensures your local copy is up-to-date with remote changes. -------------------------------- ### Pull changes from your Git repository on Bitbucket Cloud Source: https://support.atlassian.com/bitbucket-cloud/docs/build-test-and-deploy-with-pipelines/index Learn how to fetch and integrate changes from a remote Git repository, specifically from Bitbucket Cloud, into your local repository. ```bash git pull origin ``` -------------------------------- ### Set up Project Access keys on macOS Source: https://support.atlassian.com/bitbucket-cloud/docs/build-test-and-deploy-with-pipelines/index Configure SSH keys for project access on macOS. This allows secure authentication for Git operations related to your Bitbucket projects. -------------------------------- ### Create an access token for a project Source: https://support.atlassian.com/bitbucket-cloud/docs/build-test-and-deploy-with-pipelines/index Learn how to generate project-specific access tokens in Bitbucket Cloud. These tokens are used for authenticating API requests for a particular project. -------------------------------- ### Use Bitbucket REST API v1 - invitations Resource Source: https://support.atlassian.com/bitbucket-cloud/docs/build-test-and-deploy-with-pipelines/index Manage invitation resources for Bitbucket Cloud through the REST API v1. This covers creating, accepting, or rejecting invitations to collaborate. ```bash curl -u : https://api.bitbucket.org/1.0/invitations/ ``` -------------------------------- ### Use Bitbucket REST API v1 - invitations Endpoint Source: https://support.atlassian.com/bitbucket-cloud/docs/build-test-and-deploy-with-pipelines/index Handle invitations for users to join Bitbucket Cloud groups or repositories using the REST API v1. This allows for programmatic management of user access. ```bash curl -u : https://api.bitbucket.org/1.0/invitations ``` -------------------------------- ### Configure project permissions for users and groups Source: https://support.atlassian.com/bitbucket-cloud/docs/build-test-and-deploy-with-pipelines/index Manage access control for your Bitbucket Cloud projects by assigning specific permissions to users and groups. -------------------------------- ### Add default reviewers to a project Source: https://support.atlassian.com/bitbucket-cloud/docs/build-test-and-deploy-with-pipelines/index Configure default reviewers for pull requests within a Bitbucket Cloud project. This helps ensure consistent code review practices. -------------------------------- ### Run Docker Commands in Bitbucket Pipelines Source: https://support.atlassian.com/bitbucket-cloud/docs/build-test-and-deploy-with-pipelines/index This section explains how to execute Docker commands within Bitbucket Pipelines. It covers using Docker images as build environments and building/pushing Docker images to container registries. ```YAML pipelines: default: - step: name: Build and push Docker image services: - docker script: - docker build -t my-docker-image . - docker push my-docker-registry/my-docker-image ``` -------------------------------- ### Pushing Changes Back to Repository from Bitbucket Pipelines Source: https://support.atlassian.com/bitbucket-cloud/docs/build-test-and-deploy-with-pipelines/index This snippet covers how to make changes to your repository directly from within a Bitbucket Pipeline and push those changes back. This is useful for automated version bumping or file updates. ```bash # Example script to commit and push changes # git config --global user.email "your-email@example.com" # git config --global user.name "Your Name" # git add . # git commit -m "Automated commit from pipeline" # git push origin HEAD:$BITBUCKET_BRANCH ``` -------------------------------- ### YAML Anchors for Reusability in Bitbucket Pipelines Source: https://support.atlassian.com/bitbucket-cloud/docs/build-test-and-deploy-with-pipelines/index This snippet demonstrates the use of YAML anchors to reduce repetition and simplify bulk updates in Bitbucket Pipelines configuration files. Anchors allow you to define reusable blocks of YAML. ```yaml # Example of YAML anchors # definitions: # steps: # - step: # name: Build # script: # - echo "Building..." # # pipelines: # default: # - <<: *build ``` -------------------------------- ### Use a Git branch to merge a file Source: https://support.atlassian.com/bitbucket-cloud/docs/build-test-and-deploy-with-pipelines/index Explore the process of using Git branches to isolate changes and then merge them back into the main codebase. This is a core concept for collaborative development. ```bash git checkout -b ``` ```bash git merge ``` -------------------------------- ### Create a pull request to merge your change Source: https://support.atlassian.com/bitbucket-cloud/docs/build-test-and-deploy-with-pipelines/index Learn how to submit a pull request to merge your code changes from a feature branch into the main branch. This is a key step in collaborative code review. ```bash git push origin ``` ```bash # Then create a pull request in the Bitbucket UI ``` -------------------------------- ### Integrate Bitbucket Cloud with Slack Source: https://support.atlassian.com/bitbucket-cloud/docs/build-test-and-deploy-with-pipelines/index Connect Bitbucket Cloud to Slack to receive real-time notifications about repository events, such as pull requests, comments, and pipeline status updates. This integration improves team communication and awareness. -------------------------------- ### Integrate Bitbucket Cloud with Jira Cloud Source: https://support.atlassian.com/bitbucket-cloud/docs/build-test-and-deploy-with-pipelines/index Connect Bitbucket Cloud repositories to Jira Cloud projects to streamline development workflows. This integration allows for linking commits, branches, and pull requests to Jira issues, enabling better traceability and collaboration. -------------------------------- ### Use Bitbucket REST API v1 - users Endpoint (1.0) Source: https://support.atlassian.com/bitbucket-cloud/docs/build-test-and-deploy-with-pipelines/index Retrieve information about users in Bitbucket Cloud using the users endpoint of the REST API v1. This provides details about user accounts and their associated data. ```bash curl -u : https://api.bitbucket.org/1.0/users ``` -------------------------------- ### Using Glob Patterns in Bitbucket Pipelines YAML Source: https://support.atlassian.com/bitbucket-cloud/docs/build-test-and-deploy-with-pipelines/index This snippet explains the use of glob patterns within the Bitbucket Pipelines YAML file. Glob patterns are used for matching file paths, often in artifact definitions or script commands. ```yaml # Example of using glob patterns for artifacts # artifacts: # paths: # - build/libs/*.jar # - dist/**/*.js ``` -------------------------------- ### Configure a project's branch restrictions Source: https://support.atlassian.com/bitbucket-cloud/docs/build-test-and-deploy-with-pipelines/index Implement branch restrictions in Bitbucket Cloud projects to control who can push to specific branches and enforce certain workflows. -------------------------------- ### Use Bitbucket REST API v1 - group-privileges Endpoint Source: https://support.atlassian.com/bitbucket-cloud/docs/build-test-and-deploy-with-pipelines/index Manage privileges for groups in Bitbucket Cloud via the REST API v1. This endpoint facilitates the configuration of access rights for different user groups. ```bash curl -u : https://api.bitbucket.org/1.0/groups//privileges ``` -------------------------------- ### Use Smart Commits in Bitbucket Source: https://support.atlassian.com/bitbucket-cloud/docs/build-test-and-deploy-with-pipelines/index Enable and utilize Smart Commits in Bitbucket to automate Jira issue transitions and actions directly from commit messages. This feature enhances workflow efficiency by linking code changes to project management tasks. -------------------------------- ### Use Bitbucket REST API v1 - groups Endpoint Source: https://support.atlassian.com/bitbucket-cloud/docs/build-test-and-deploy-with-pipelines/index Access and manage group resources within Bitbucket Cloud using the REST API v1. This endpoint allows for programmatic creation, retrieval, and modification of user groups. ```bash curl -u : https://api.bitbucket.org/1.0/groups ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.