robotsnoindex

Manual steps

Manual steps allow you to customize your CI/CD pipeline by making some steps run only they're manually triggered. This is useful for items such as deployment steps, where manual testing or checks are required before the step runs.

Configure a step as manual by adding  trigger: manual to the step in your bitbucket-pipelines.yml file.

As pipelines trigger 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.

Manual pipelines

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.


Step 1: 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:

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."

Step 2: 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.

Run a pipeline manually from the Branches view
  1. In Bitbucket, choose a repo and go to Branches.
  2. Choose the branch you want to run a pipeline for.
  3. Click (...) , and select Run pipeline for a branch.
  4. Choose a pipeline and click Run:
Run a pipeline manually from the Commits view
  1. In Bitbucket, choose a repo and go to Commits.
  2. Go to the Commits view for a commit.
  3. Select a commit hash.
  4. Select Run pipeline.
  5. Choose a pipeline, then click Run:
Run a pipeline manually from the Pipelines page
  1. In Bitbucket, choose a repo and go to Pipelines.
  2. Click Run pipeline
  3. 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:

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 (Branches ⋯ Run pipeline for a branch > Custom:..) you'll be able to fill them in.