Why do I see 'HEAD' instead of a correct branch name in the user dashboard?
Knapsack Pro automatically identifies your branch name using environment variables from supported CI providers for Ruby, Cypress, and Jest. However, in some cases, particularly for pull request merge commits, a CI provider might only expose HEAD
instead of the actual branch name.
This issue may also occur with CI providers not natively supported by Knapsack Pro. By setting KNAPSACK_PRO_REPOSITORY_ADAPTER=git
, you can instruct Knapsack Pro to use the local Git installation on the CI node to determine the branch name and git commit. The documentation provides further details for Ruby, Cypress, and Jest.
Knapsack Pro executes the Git command git -C /home/user/project_dir rev-parse --abbrev-ref HEAD
to detect the branch name. However, if the CI build checks out a specific git commit, Git will return HEAD
instead of the branch name. While having HEAD
as the branch name generally does not impact Knapsack Pro’s functionality and its ability to track test file timing history for better test suite splitting, the exact branch name can provide slightly more precise tracking.
If you prefer to see the exact branch name in your build metrics history on the user dashboard, you can manually specify it for each CI build using the KNAPSACK_PRO_BRANCH
environment variable.