Drone

Support for Bitbucket Server (Stash) Pull Request Modified events

Hi Team,

We are facing issue in pull request work flow with the new Drone1.6.1 where we are not able to trigger the build using the comments(/test, /retest). Since we get this issue we are not able to build the PR with any new changes to the same Pull request and we can’t create separate PRs for all the fixes.

Regards,
Ranjith

I am not sure I understand the issue. Drone has never supported triggering builds using /test or /retest comments. Builds for pull requests are triggered by 1) opening a new pull request or 2) pushing to an existing branch with an open pull request.

As an aside, it is helpful to specify whether you are using Bitbucket Cloud (at bitbucket.org) or Bitbucket Server (self-hosted) since they are different products.

Hi Brad

We are using bit-bucket server (self hosted).

We made some custom changes with drone 0.8 source code to support these features i.e. comment based re-triggering Pull-Request build using /test, /retest etc. in Pull-Request comment section which will include any changes pushed with a new commit for the existing Pull Request

This is not working with drone-1.6 as whenever the pull request is updated with new commits, only the normal pipeline on the branch is run, not the ‘pull request’ pipeline.

In a scenario where a Pull-Request build fails then it’s not possible to trigger the build with new commits which contains the fix and we have mandatory policy of having 1 minimum successful builds for any PR to get merged.

Basically, we are looking for an option to link the subsequent successful build with the new commits to the existing Pull-Request?

Regards
Rohit

This is not working with drone-1.6 as whenever the pull request is updated with new commits, only the normal pipeline on the branch is run, not the ‘pull request’ pipeline.

This is unfortunately a problem with Bitbucket for which they have an open issue. See https://jira.atlassian.com/browse/BSERV-10279

Hi @bradrydzewski
I am using bitbucket server webhook to trigger the build on drone,
I have set this event as trigger pull_request but this only trigger build when pull request first opened It doesn’t trigger build if the same pull request updates with new changes.
https://jira.atlassian.com/browse/BSERV-10279 has been resolved and I have latest bitbucket server running which supports source branch updated webhook for PR ,

I am using drone server version 1.7
I am still not able to get build triggered when existing pull request is updated with new changes/commits

can you please help what could be the issue.

Thanks,
Sumit

This was only recently resolved by Atlassian (3 weeks ago) in Stash 7.0.0. Accepting this new webhook will still require code changes in Drone to detect source branch updated hooks, which we have not had the chance to make yet.

Thanks @ashwilliams1,
Do we have any plan to implement changes in Drone to accommodate detect source branch updated hook in near time soon ?

Thanks,
Sumit

this is something we will add to our roadmap for a future release

2 Likes

Hi @ashwilliams1,

is there a github issue that I can follow regarding this?

We also have the issue with bitbucket that when a branch that is used in a pull-request gets updated it results in only one build for the branch. We expect there to be two builds, one for the branch and one for the pull request (PR source branched merged into PR target branch).

There are two issues currently:

  1. The webhook event “Source branch updated” is not activated in the webhook that drone created in bitbucket.
    image

  2. Drone doesn’t react to the webhook even if activated manually.Here is an example of the request:

    Request details

    Event type:

    pr:from_ref_updated

    URL endpoint:

    http://drone-controller.mydomain.com/hook

    Headers

    X-Hub-Signature: sha256=66ab2e32e8398f7cbce7d72713b82b81dab649873c763a9886661aadc653764b
    X-Request-Id: 06655cbc-5177-4d35-b6cb-2139a180f0eb
    Content-Type: application/json; charset=utf-8 X-
    Event-Key: pr:from_ref_updated

    {
    “eventKey”: “pr:from_ref_updated”,
    “date”: “2020-05-07T11:16:34+0200”,
    “actor”: {
    “name”: “my.name”,
    “emailAddress”: “my.name”,
    “id”: 2348,
    “displayName”: “name my”,
    “active”: true,
    “slug”: “my.name”,
    “type”: “NORMAL”,
    “links”: {
    “self”: [
    {
    “href”: “/users/my.name”
    }
    ]
    }
    },
    “pullRequest”: {
    “id”: 6,
    “version”: 64,
    “title”: “.drone.yml edited online with Bitbucket”,
    “description”: “with diff opening”,
    “state”: “OPEN”,
    “open”: true,
    “closed”: false,
    “createdDate”: 1587979926598,
    “updatedDate”: 1588842994240,
    “fromRef”: {
    “id”: “refs/heads/bugfix/test_pr_fetch”,
    “displayId”: “bugfix/test_pr_fetch”,
    “latestCommit”: “c053fab0604729af7c4c7a1088752780f32013aa”,
    “repository”: {
    “slug”: “test”,
    “id”: 298,
    “name”: “test”,
    “hierarchyId”: “d7fd381c7e72eafd6f58”,
    “scmId”: “git”,
    “state”: “AVAILABLE”,
    “statusMessage”: “Available”,
    “forkable”: true,
    “project”: {
    “key”: “~my.name”,
    “id”: 129,
    “name”: “name my”,
    “type”: “PERSONAL”,
    “owner”: {
    “name”: “my.name”,
    “emailAddress”: “my.name”,
    “id”: 2348,
    “displayName”: “name my”,
    “active”: true,
    “slug”: “my.name”,
    “type”: “NORMAL”,
    “links”: {
    “self”: [
    {
    “href”: “/users/my.name”
    }
    ]
    }
    },
    “links”: {
    “self”: [
    {
    “href”: “/users/my.name”
    }
    ]
    }
    },
    “public”: false,
    “links”: {
    “clone”: [
    {
    “href”: “/scm/~my.name/test.git”,
    “name”: “http”
    }
    ],
    “self”: [
    {
    “href”: “/users/my.name/repos/test/browse”
    }
    ]
    }
    }
    },
    “toRef”: {
    “id”: “refs/heads/master”,
    “displayId”: “master”,
    “latestCommit”: “e3070bbea0d859145c73c690574f56b90bc822dc”,
    “repository”: {
    “slug”: “test”,
    “id”: 298,
    “name”: “test”,
    “hierarchyId”: “d7fd381c7e72eafd6f58”,
    “scmId”: “git”,
    “state”: “AVAILABLE”,
    “statusMessage”: “Available”,
    “forkable”: true,
    “project”: {
    “key”: “~my.name”,
    “id”: 129,
    “name”: “name my”,
    “type”: “PERSONAL”,
    “owner”: {
    “name”: “my.name”,
    “emailAddress”: “my.name”,
    “id”: 2348,
    “displayName”: “name my”,
    “active”: true,
    “slug”: “my.name”,
    “type”: “NORMAL”,
    “links”: {
    “self”: [
    {
    “href”: “/users/my.name”
    }
    ]
    }
    },
    “links”: {
    “self”: [
    {
    “href”: “/users/my.name”
    }
    ]
    }
    },
    “public”: false,
    “links”: {
    “clone”: [
    {
    “href”: “/scm/~my.name/test.git”,
    “name”: “http”
    }
    ],
    “self”: [
    {
    “href”: “/users/my.name/repos/test/browse”
    }
    ]
    }
    }
    },
    “locked”: false,
    “author”: {
    “user”: {
    “name”: “my.name”,
    “emailAddress”: “mymail”,
    “id”: 2348,
    “displayName”: “name my”,
    “active”: true,
    “slug”: “my.name”,
    “type”: “NORMAL”,
    “links”: {
    “self”: [
    {
    “href”: “/users/my.name”
    }
    ]
    }
    },
    “role”: “AUTHOR”,
    “approved”: false,
    “status”: “UNAPPROVED”
    },
    “reviewers”: [],
    “participants”: [],
    “links”: {
    “self”: [
    {
    “href”: “/users/my.name/repos/test/pull-requests/6”
    }
    ]
    }
    },
    “previousFromHash”: “8ff90f3f503e6112cc67f5aa004422759cedf1b5”
    }

Thank you for your help,
regards Stephan

@SPFZ you can remain subscribed to this thread. We will post any progress updates here. You can follow our roadmap here.

1 Like