How to run pipelines builds on historical commits which do not contain a bitbucket-pipelines.yml file
プラットフォームについて: Cloud のみ - この記事は、 クラウド プラットフォームのアトラシアン製品にのみ適用されます。
要約
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.
ソリューション
You can run the pipeline build on these commits where the bitbucket-pipelines.yml is not available for selection using the following workarounds.
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.
pipelines:
branches:
staging:
- step:
script:
- git reset --hard <commit-hash-here>
注意:
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.
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