-
Notifications
You must be signed in to change notification settings - Fork 652
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using Bitbucket Pipelines the current branch can not be evaluated when on develop branch #2900
Comments
Sounds like you may have a shallow repository checked out without an explicit branch or something like that. What happens if you do |
This results in the following error: fatal: --unshallow on a complete repository does not make sense |
Hm, ok. Does adding the environment variable |
This does also not change the result. I see two mechanisms that are both not available in this case:
|
Strange. I agree that
I'm not sure why GitVersion doesn't pick |
Just want to pitch in that I have the same issue. Easy way to reproduce without bitbucket
Redacted output:
|
Detached I don't think it's a good idea to introduce heuristics that choose the first branch the checked out commit is found on to generate a version number. |
@asbjornu agreed. What about explicitely passing the name as an argument? |
Don't just use the environment variable GIT_BRANCH in GitPreparer to find the current branch; allow GIT_BRANCH to specify which branch is being built in the GitVersionContext as well, so it can be used throughout the codebase. Fixes GitToolsGH-2900.
@smuellener, that's what the environment variable |
May be fixed or at least improved by #3338. Closing due to inactivity, please let me know how this fares after the next v5 release. |
🎉 This issue has been resolved in version 5.12.0 🎉 Your GitReleaseManager bot 📦🚀 |
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
The text was updated successfully, but these errors were encountered: