Get started with Bitbucket Pipelines

We’re rolling out a new way of onboarding into Pipelines. In the following docs you can follow two different sets of steps to help you with your specific onboarding experience.

Get started with Pipelines

Bitbucket Pipelines is an integrated CI/CD service, built into Bitbucket. It allows you to automatically build, test, and even deploy your code, based on a configuration file in your repository. Essentially, we create containers in the cloud for you. Inside these containers, you can run commands (like you might on a local machine) but with all the advantages of a fresh system, custom configured for your needs.

Understand the YAML file

A pipeline is defined using a YAML file called bitbucket-pipelines.yml, which is located at the root of your repo. You can learn how to write it here.

Configure your first pipeline

There are two ways to configure your pipeline: you can either directly write the YAML file or you can use the UI wizard provided by Bitbucket. In the following walk-through guide, we’ll show you how to use the wizard.

If you have the new onboarding experience check out these steps:

Prerequisites

  • You need to have a Bitbucket Cloud instance.

  • Your instance must have at least one repository.

Steps

  1. In Bitbucket, go to your repository and select Pipelines.

  2. Click Create your first pipeline to scroll down to the template section.

  3. Choose one of the available templates. If you aren’t sure, you can use the one RECOMMENDED. Templates cover a variety of use cases and technologies such as apps, microservices, mobile IaaC, and Serverless development. We support major cloud providers such as AWS, Azure, and GCP. We support the top used languages such as NodeJS, PHP, Java, Python, and .NET Core., however, based on the language configured in your Bitbucket repository, the template list automatically recommends templates with that language.

image_1

4. Once you use a template, you will land in the YAML editor where you can configure your pipeline. You can learn more about YAML syntax here.

image2

Change template

You can change the template anytime by opening the dropdown and selecting a different template. Keep in mind that if you choose a new template, it will override the existing content.

 

image3

Add more steps

You can easily add more steps. Hover over the options in the steps panel and copy the code snippet then, add it to the editor.

 

image4

Add Pipes

Pipes allow you to easily configure a pipeline with third-party tools. Learn more here.

To use a pipe you just have to select the pipe you want to use, copy, and paste the code snippet in the editor. There are dozens of pipes, see the full list by clicking Explore more pipes.

image5

Add variables

You can define custom variables that you can use in the YAML file. To add a variable, fill in the name, the value, check whether you want to encrypt it by clicking the secured box, and click Add.

image6

If you have the classic onboarding experience check out these steps:

Prerequisites

  • You need to have a Bitbucket Cloud instance.

  • Your instance must have at least one repository.

Steps:

  1. In Bitbucket, create a repository or choose an existing one.

  2. Go to Pipelines. If this is the first time you enter the Pipelines menu, you will be presented with an overview screen.

  3. Click Start using Pipelines.

  4. Choose a language template you want to work with to get a predetermined yaml template.

  5. Now, you can decide whether you want to add more steps to the template. Steps are executed in the order that they appear in the bitbucket-pipelines. yml file. You can use up to 100 steps in a single pipeline. Each step in your pipeline will start a separate Docker container to run the commands configured in the script. You can also add Pipes to the templates.

  6. Configure pipeline variables by clicking the cog icon and selecting the variables you want.

  7. Once you’ve configured the .yml file, commit the changes by clicking Commit file.

Outcome

Now that you’ve configured your first pipeline, you can always go back to the yaml editor by clicking the pipeline cog icon. Learn more about the Pipeline screen here.

 

 

Additional Help

Ask the Community