Rebuild when PR is updated

#1

We need builds for changes to the master branch only. Additionally, we’d like to have builds for PR branches. The repo is hosted on GitHub.

Currently, we have the following trigger map:

trigger_map:
- push_branch: master
  workflow: test
- pull_request_source_branch: "*"
  workflow: test

When we push to a new branch, no build is triggered. When we create a PR with this new branch, a build is triggered. This is exactly what we want, but when we now push additional commits to this branch, we would expect Bitrise to rebuild because it was a push to a PR branch. Travis CI does this, which is very useful.

Can we achieve this without triggering builds for all pushes to all branches? If not, please move this thread to Feature Requests.

0 Likes

#2

There is a related feature request: Automatically re-build open pull request when target branch is updated (e.g. another Pull Request is merged)

This other thread requests a rebuild whenever the target branch is changed. I, however, would like a rebuild when the source branch is changed.

0 Likes

#3

Hi @dseither_pg :wave: :slight_smile:

What do you mean by this?

Maybe I missed something, but if you create a PR, which as you described does trigger a build for that PR, and then you push a commit to that PR’s branch it should automatically trigger a new build.

The other feature request you linked is to rebuild all other PRs when a PR is merged; but building that PR where you push changes is how it works by default on bitrise.io

Are you sure that you created a PR, which did trigger a build, and then you pushed code to that PR’s branch, and that did not trigger a build?

Did that happen multiple times? Asking because GitHub once again has some issues (October 17, 2017 - https://status.github.com/messages) which might cause the issue (that GitHub did not send that webhook to bitrise.io). In general the best is to check the Webhook History on GitHub, as bitrise.io always specifies the reason why it did not start a build for a webhook (if it did receive the webhook / if GitHub did send the webhook): http://devcenter.bitrise.io/webhooks/troubleshooting/

0 Likes

#4

You’re right, it should work like that, and now it does. Seems like this was a Github issue. Thanks!

1 Like

#5

Glad to hear it works now @dseither_pg, sorry for the inconvenience - indeed GitHub had a rough day yesterday, from time to time they had 15+ minutes of delays delivering webhooks…

Hopefully it’ll remain stable now :slight_smile:

0 Likes

#6

The solution commented here doesn’t seem to work for me. Having the following triggers configured:
trigger_map:

  • push_branch: dev
    workflow: Dev
  • pull_request_source_branch: *
    workflow: PR
  • pull_request_target_branch: *
    workflow: PR

pushing new commits to the PR source branch DOES NOT trigger a new build.
The webhook is being delivered by GitHub, but this is the response I got:
{"success_responses":[],"failed_responses":[{"status":"error","message":"trigger pattern did not match any defined mapping: no matching pipeline \u0026 workflow found with trigger params: push-branch: feature/ANDROID-1702_migrate_ticket_detail_to_retrofit, pr-source-branch: , pr-target-branch: , tag: ","service":"bitrise","slug":"b3c703132bddaba4","build_slug":"","build_number":0,"build_url":"","triggered_workflow":""}]}

0 Likes

#7

Hello @carlos.salguero
Do you have “PR” as the name of the workflow?
You have to write the name of the workflow next after the branch name.

Thanks
Chaitanya

0 Likes