"pull-request" pipelines are executed only on commit when triggered manually
Asked by Milad:

Hi,

we have a pipeline which is defined using the "pull-requests" keyword. See <https://support.atlassian.com/bitbucket-cloud/docs/pipeline-start-conditions/#Pull-Requests>

My problem is that when running that pipeline manually from UI (e.g. because "\[no ci\]" was added previously to commit message) the pipeline does not behave like a pull-request pipeline anymore. Problems arising from this:

* Step "condition" is only evaluated based on commit, not the whole pull-request.
* The target branch is not merged into the pull-request branch before executing the pipeline.
* PR specific variables like "BITBUCKET_PR_ID" are not set (which I believe our external visual testing integration with <https://percy.io/> relies on)

My question is: Can this be considered a bug? As, I have defined the pipeline using the keyword "pull-requests".

Is there any alternative way to make a pipeline behave as a "pull-request" pipeline when triggered manually?

Some background: To reduce costs, we don't want every commit to cause a pipeline run (depending on a developer's git usage habit, a pull-request can have many commits). So, we would like to somehow run the pipelines manually only when needed. But, currently, it's not possible to do that without losing the "pull-request" pipeline behavior.

Thank you for any help.

Regards

Milad


Answers:
author: Theodora Boudale
body: Hi Milad,

When triggering a pipeline manually from our website, it is possible to trigger it only for a branch or a certain commit. There is no option to trigger a pull-requests pipeline for a certain PR. I can create a feature request for our development team to consider, please feel free to let me know if you'd like me to do that.

In the meantime, you can work around this issue in one of the following two ways:

**1.** In a clone of the repo, create an empty commit on the source branch without the \[skip ci\] option:

```
git commit --allow-empty -m "Empty commit to trigger the pull-requests pipeline"
```

When you push that commit to the source branch, the pull-requests pipeline will be triggered.

**2.** You can use our API to trigger a pull-requests pipeline for a specific PR:

* <https://developer.atlassian.com/cloud/bitbucket/rest/api-group-pipelines/#trigger-a-pull-request-pipeline>

This will work even if the last commit of the source branch has \[skip ci\] in its message.

Please feel free to let me know if you have any questions!

Kind regards,  
Theodora

comments: author: Milad
body: Hi Theodora,

I was not aware of these options, so thanks for sharing them. I will discuss it with my team, and we will somehow manage with them for the moment.

Furthermore, I would also be happy for you to create a feature request for this, as I think having a UI option would be more user-friendly. Could you please share the link here so I can watch it?

Thank you.

Milad


author: Theodora Boudale
body: Hi Milad,

You are very welcome.

I created the feature request:

* <https://jira.atlassian.com/browse/BCLOUD-23152>

You can add your vote (by selecting the **Vote for this issue** link) and also add yourself as a watcher (by selecting the **Start watching this issu**e link).

Implementation of features is done as per our policy [here](https://confluence.atlassian.com/support/implementation-of-new-features-policy-201294576.html) and any updates will be posted in the feature request.

Kind regards,  
Theodora


Tags: bitbucket-cloud

cloud