Skip to content

Using Bitbucket Pipelines the current branch can not be evaluated when on develop branch #2900

@smuellener

Description

@smuellener

When on develop and using Bitbucket Pipelines and gitversion from a docker container, the branch can not be evaluated and (no branch) is shown in the diag log. If the same is run when on a feature branch, gitversion works fine.

running:

docker run --volume $(pwd):/repo gittools/gitversion:5.7.1-alpine.3.12-x64-5.0 /repo -nofetch -nonormalize -diag

shows:

INFO [11/04/21 18:33:53:85] Working directory: /repo
INFO [11/04/21 18:33:53:88] Project root is: /repo/
INFO [11/04/21 18:33:53:88] DotGit directory is: /repo/.git
INFO [11/04/21 18:33:54:06] Using latest commit on specified branch
INFO [11/04/21 18:33:54:08] Begin: Getting branches containing the commit '8c55d5a'.
INFO [11/04/21 18:33:54:08] Trying to find direct branches.
INFO [11/04/21 18:33:54:08] No direct branches found, searching through all branches.
INFO [11/04/21 18:33:54:08] Searching for commits reachable from 'develop'.
INFO [11/04/21 18:33:54:09] The branch 'develop' has a matching commit.
INFO [11/04/21 18:33:54:09] Searching for commits reachable from 'origin/HEAD'.
INFO [11/04/21 18:33:54:09] The branch 'origin/HEAD' has a matching commit.
INFO [11/04/21 18:33:54:09] End: Getting branches containing the commit '8c55d5a'. (Took: 11.28ms)
INFO [11/04/21 18:33:54:10] No branch configuration found for branch (no branch), falling back to default configuration
INFO [11/04/21 18:33:54:10] Begin: Attempting to inherit branch configuration from parent branch
INFO [11/04/21 18:33:54:11] Begin: Finding branch source of '(no branch)'
INFO [11/04/21 18:33:54:13] Begin: Finding merge base between '(no branch)' and 'develop'.
INFO [11/04/21 18:33:54:14] Found merge base of 3d6f3ea Merge branch 'feature/xyz' into develop
INFO [11/04/21 18:33:54:15] Merge base of (no branch)' and 'develop is 3d6f3ea Merge branch 'feature/xyz' into develop
INFO [11/04/21 18:33:54:15] End: Finding merge base between '(no branch)' and 'develop'. (Took: 16.75ms)
INFO [11/04/21 18:33:54:15] Begin: Finding merge base between '(no branch)' and 'origin/develop'.
INFO [11/04/21 18:33:54:15] Found merge base of 3d6f3ea Merge branch 'feature/xyz' into develop
INFO [11/04/21 18:33:54:15] Merge base of (no branch)' and 'origin/develop is 3d6f3ea Merge branch 'feature/improveqmlbackendserver' into develop
INFO [11/04/21 18:33:54:15] End: Finding merge base between '(no branch)' and 'origin/develop'. (Took: 0.34ms)

. . .

INFO [11/04/21 18:33:54:31] Multiple source branches have been found, picking the first one (develop).
This may result in incorrect commit counting.
Options were:
develop, origin/develop, origin/hotfix/2.9.7, origin/master, origin/release/2.7.0, origin/release/2.6.0, origin/release/2.5.0, origin/release/2.4.0
INFO [11/04/21 18:33:54:31] End: Finding branch source of '(no branch)' (Took: 193.34ms)
INFO [11/04/21 18:33:54:31] Begin: Getting branches containing the commit '3d6f3ea'.
INFO [11/04/21 18:33:54:31] Trying to find direct branches.
INFO [11/04/21 18:33:54:31] No direct branches found, searching through all branches.
INFO [11/04/21 18:33:54:31] Searching for commits reachable from 'develop'.
INFO [11/04/21 18:33:54:31] The branch 'develop' has a matching commit.
INFO [11/04/21 18:33:54:31] Searching for commits reachable from 'origin/hotfix/2.9.7'.
INFO [11/04/21 18:33:54:47] The branch 'origin/hotfix/2.9.7' has no matching commits.
INFO [11/04/21 18:33:54:47] Searching for commits reachable from 'origin/master'.
INFO [11/04/21 18:33:54:64] The branch 'origin/master' has no matching commits.
INFO [11/04/21 18:33:54:64] Searching for commits reachable from 'origin/release/2.4.0'.
INFO [11/04/21 18:33:54:69] The branch 'origin/release/2.4.0' has no matching commits.
INFO [11/04/21 18:33:54:69] Searching for commits reachable from 'origin/release/2.5.0'.
INFO [11/04/21 18:33:54:76] The branch 'origin/release/2.5.0' has no matching commits.
INFO [11/04/21 18:33:54:76] Searching for commits reachable from 'origin/release/2.6.0'.
INFO [11/04/21 18:33:54:82] The branch 'origin/release/2.6.0' has no matching commits.
INFO [11/04/21 18:33:54:82] Searching for commits reachable from 'origin/release/2.7.0'.
INFO [11/04/21 18:33:54:91] The branch 'origin/release/2.7.0' has no matching commits.
INFO [11/04/21 18:33:54:91] End: Getting branches containing the commit '3d6f3ea'. (Took: 604.65ms)
INFO [11/04/21 18:33:54:91] Found possible parent branches: develop
INFO [11/04/21 18:33:54:91] End: Attempting to inherit branch configuration from parent branch (Took: 811.45ms)
INFO [11/04/21 18:34:01:64] Running against branch: (no branch) (8c55d5a Add logging to GitVersion)
WARN [11/04/21 18:34:01:64] An error occurred:
It looks like the branch being examined is a detached Head pointing to commit '8c55d5a'. Without a proper branch name GitVersion cannot determine the build version.
INFO [11/04/21 18:34:01:66] Done writing

I tried other versions of gitversion 5.x but with no success. I also tried adding the git branch name as an argument ("-b ") but also without luck.

In the log I can see "The branch 'develop' has a matching commit." Could this not be used to create the version number from there?

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions