How to run pipelines builds on historical commits which do not contain a bitbucket-pipelines.yml file

Platform Notice: Cloud Only - This article only applies to Atlassian products on the cloud platform.

Summary

There are use cases where you would want to run a pipeline build on a commit that was created a long time ago, before enabling pipelines, and does not contain a bitbucket-pipelines.yml file. This situation occurs when repositories are imported from different DVCS systems, such as GitHub or GitLab, or when pipelines are enabled on a repository that already contains commits.

eg: The "Run Pipeline" option is available on the commit page, but there is no "bitbucket-pipelines.yml" available for selection.

(Auto-migrated image: description temporarily unavailable)
(Auto-migrated image: description temporarily unavailable)

Solution

Using the following workarounds, you can run the pipeline build on these commits where the bitbucket-pipelines.yml is not available for selection.

Workaround 1:

Run Pipeline Against a Branch You can run the pipeline build on these commits where the `bitbucket-pipelines.yml` is not available for selection using the following workaround.

1 2 3 4 5 6 pipelines: branches:     staging:       - step:           script:             - git reset --hard <commit-hash-here>

Note:

 one can create a custom pipeline step where you can input <commit-hash> as a variable value and the same will be referred to in the pipeline script command. eg: "git reset --hard ${INPUT_COMMIT}"

Workaround 2:

You can create a new branch from the <commit-hash>, add a bitbucket-pipelines.yml with your configuration, which includes the runpipelines branch, and push back the repository so that the pipeline build will run on the push of this branch.

1 2 3 4 5 6 7 8 9 git clone https://bitbucket.org/<workspace>/<repo.git> cd <repo.git> git checkout -b runpipelines <commit-hash-here> #here we create *runpipelines* branch from <commit-hash-here> commit Create a bitbucket-pipelines.yml with your configuration, which includes the *runpipelines* branch push back the repository

Updated on March 3, 2025

Still need help?

The Atlassian Community is here for you.