Search code examples
dockerbamboo

How to get Atlassian Bamboo repository caching to work with docker?


Atlassian Bamboo repository caching causes issue with docker:

error: object directory $BAMBOO_HOME/xml-data/build-dir/_git-repositories-cache/8454c6d4af76ff5751c9e2ecf0bd2d2371695eec/.git/objects does not exist; check .git/objects/info/alternates
error: Could not read d55f59e8de25d61533151b43092751e40269b31d

Note that we don't use docker agent because of permission issues, and the need for elevated privilege and capabilities.


Solution

  • The cache directory has to be added to docker as a volume using Bamboo's $bamboo_git_cache_directory environment variable:

    docker run --rm -v $bamboo_git_cache_directory:$bamboo_git_cache_directory -v $(pwd):/workspace python:3.9 ...