Drone target and source branch env vars are the same (Bitbucket)

My expectation was that the DRONE_SOURCE_BRANCH would be feature/FRE-281 and that DRONE_TARGET_BRANCH would be master however I get:

+ echo $DRONE_BRANCH
feature/FRE-281
+ echo $DRONE_TARGET_BRANCH
feature/FRE-281
+ echo $DRONE_COMMIT_BRANCH
feature/FRE-281
+ echo $DRONE_SOURCE_BRANCH
feature/FRE-281

Is this a Bitbucket specific issue?

The source branch and target branch are only different for pull request events, where you are requesting to merge code from source branch A to target brach B. Bitbucket (bitbucket.org) does not support pull request refs which prevents Drone from being able to process pull request hooks [1]. Drone only processes push hooks from Bitbucket which is why the source branch always matches the target branch.

[1] https://jira.atlassian.com/browse/BCLOUD-5814

1 Like