Get started with Bitbucket Cloud
New to Bitbucket Cloud? Check out our get started guides for new users.
Bitbucket allows you to run multiple pipelines by triggering them manually or by scheduling the trigger at a given time.
Manual steps allow you to customize your CI/CD pipeline by making some steps run only if they are manually triggered. This is useful for items such as deployment steps, where manual testing or checks are required before the step runs.
Configure a manual step by adding trigger: manual to the step in your bitbucket-pipelines.yml file.
Since a pipeline is triggered on a commit, you can't make the first step manual. If you'd like a pipeline to only run manually, you can set up a custom pipeline instead. Another advantage of a custom pipeline is that you can temporarily add or update values for your variables, for example, to add a version number, or supply a single-use value.
Any existing pipeline can also be manually run against a specific commit, or as a scheduled build.
If you want a pipeline to only run manually then use a custom pipeline. Custom pipelines do not run automatically on a commit to a branch. To define a custom pipeline, add the pipeline configuration in the custom section of your bitbucket-pipelines.yml file. Pipelines which are not defined as a custom pipeline will also run automatically when a push to the branch occurs.
You'll need write permission on the repository to run a pipeline manually, and you can trigger it from the Bitbucket Cloud UI.
Add a pipeline to the bitbucket-pipelines.yml file. You can manually trigger a build for any pipeline build configuration included in your bitbucket-pipelines.yml file
Example:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
pipelines:
custom: # Pipelines that can only be triggered manually
sonar:
- step:
script:
- echo "Manual triggers for Sonar are awesome!"
deployment-to-prod:
- step:
script:
- echo "Manual triggers for deployments are awesome!"
branches: # Pipelines that run automatically on a commit to a branch can also be triggered manually
staging:
- step:
script:
- echo "Automated pipelines are cool too."
Trigger the pipeline from Bitbucket Cloud. Pipelines can be triggered manually from either the Branches view or the Commits view in the Bitbucket Cloud interface.
In Bitbucket, choose a repo and go to Branches.
Choose the branch you want to run a pipeline for.
Click (...) , and select Run pipeline for a branch.
Choose a pipeline and click Run:
In Bitbucket, choose a repo and go to Commits.
Go to the Commits' view for a commit.
Select a commit hash.
Select Run pipeline.
Choose a pipeline, then click Run:
In Bitbucket, choose a repo and go to Pipelines.
Click Run pipeline
Choose branch, a pipeline, and click Run
Additionally, you can run custom pipelines manually parsing variables to the pipeline.
To enable the variables, define them under the custom pipeline that you want to enter when you run the pipeline.
Example:
1
2
3
4
5
6
7
8
9
10
pipelines:
custom:
custom-name-and-region: #name of this pipeline
- variables: #list variable names under here
- name: Username
- name: Region
- step:
script:
- echo "User name is $Username"
- echo "and they are in $Region"
Then, when you run a custom pipeline by going to Branches > ⋯ > Run pipeline for a branch > Custom.
Scheduled pipelines allow you to run a pipeline at hourly, daily or weekly intervals.
Scheduled pipelines run in addition to any builds triggered by commits, or triggered manually.
You can create a schedule for any pipeline defined in your bitbucket-pipelines.yml file.
If you make a custom pipeline it will only run when scheduled or manually triggered.
Create a pipeline. Here's a simple example showing how you would define a custom pipeline in the bitbucket-pipelines.yml file.
Example:
1
2
3
4
5
6
pipelines:
custom: # defines that this can only be triggered manually or by a schedule
staging: # The name that is displayed in the list in the Bitbucket Cloud GUI
- step:
script:
- echo "Scheduled builds in Pipelines are awesome!"
Read more about custom pipelines.
Go to the repository in Bitbucket.
Click Pipelines then Schedules (at the top right), and then click New schedule.
Choose the Branch and Pipeline that you want to schedule:
The schedule will run the HEAD commit of the branch.
The pipeline must be defined in the bitbucket-pipelines.yml on the branch you selected.
Set the Schedule:
Select how often you would like the pipeline to run (hourly, daily or weekly)
Select the time (in your local time). However, your pipeline will be scheduled in UTC time (unaffected by daylight savings hours)
The scheduled pipeline can run at any time in the selected time period. This is to distribute all schedules in Pipelines triggering across the hour.
Go to Pipelines > Schedules (at the top right-hand side of the screen) to see all the schedules for a repository.
Remove a schedule by using the 'trash' icon at the right of the schedule.
Note that schedules created using the API are displayed as a Cron expression (such as 0 10 15 * *).
Was this helpful?