Details
-
Bug
-
Resolution: Done
-
Medium
-
5.15.0.1
-
Severity 2 - Major
-
Description
Summary
Git LFS checkout will fail for any non-master branch if the master branch for that repository hasn't already been fetched into the Bamboo git cache (or the git cache has been cleared). This also occurs on remote agents when caching isn't enabled.
Steps to Reproduce
- Create a Bamboo Plan that uses a source code checkout task to fetch from a git repository with LFS content
- Ensure the repository is checking out a non-master branch
- Ensure Plan configuration > Repositories > repository > Advanced options > Enable git lfs support is enabled
- Note if this repository has been used in the past, you will need to clear the Bamboo git cache for it at Bamboo Administration > Overview > Repository settings first.
- Run the plan
Expected Results
Checkout completes successfully
Actual Results
The below error is shown in the build log or as error during change detection:
Caused by: com.atlassian.bamboo.repository.RepositoryException: : Cannot fetch branch 'refs/heads/branch' from 'git@bitbucket.org:repo-owner/lfstest.git' to source directory '/var/bamboo-home/xml-data/build-dir/_git-repositories-cache/0334bcb1c6facdb7666ff54b60cdca9e6d2bd69c'. command /usr/bin/git lfs fetch ssh://6f75ebec-a410-486b-b087-5d8c1d0d6a1a@127.0.0.1:45990/repo-owner/lfstest.git failed with code 2. Working directory was [/var/bamboo-home/xml-data/build-dir/_git-repositories-cache/0334bcb1c6facdb7666ff54b60cdca9e6d2bd69c]., stderr: Could not fetch Errors logged to /var/bamboo-home/xml-data/build-dir/_git-repositories-cache/0334bcb1c6facdb7666ff54b60cdca9e6d2bd69c/.git/lfs/objects/logs/20170227T131538.452589247.log Use `git lfs logs last` to view the log.
LFS log from git lfs logs last shows:
$ git-lfs fetch ssh://6f75ebec-a410-486b-b087-5d8c1d0d6a1a@127.0.0.1:45990/repo-owner/lfstest.git Could not fetch Git can't resolve ref: "HEAD"
Workaround
- See the second workaround for remote agents when caching isn't enabled
- Change your repository to clone the master branch and run a build, or create a separate plan that will clone master for the same repository and run a build.
- Once master has been cloned into the cache, subsequent branch builds will work.
This one could result in a rather long clone for a large LFS repository, but it's an option:
- Enable fetch whole repository under Plan configuration > Repositories > repository > Advanced Options
- Try the build again. If you have caching enabled, this only needs to be performed once.
If the git cache is cleared for whatever reason (this can happen automatically with some git command failures) and you've used a temporary form of the workaround – you'll need to perform one of the workarounds again.
Attachments
Issue Links
- mentioned in
-
Page Loading...