Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,466,295
Community Members
 
Community Events
176
Community Groups

Git error when running job in Docker Container

We're running an on-prem installation of Bamboo 6.5. I'm trying to setup a build job to run in a docker container. However, at one point I run a script in the job which runs

git diff master --name-only
This command fails with:
error: object directory /var/atlassian/application-data/bamboo/xml-data/build-dir/_git-repositories-cache/a8a7e8c0985e56b918179b7d01e7ed1189667581/.git/objects does not exist; check .git/objects/info/alternates

fatal: bad object master

 

I have git 1.8 on the server running Bamboo and the Docker container is running git version 2.34.1, which might be the source of the error. I see that Bamboo creates a docker volume for the pulled source, but I do specify that a clean clone be done every time, and I thought the git clone or pull happens in the container, not in the host. I don't think I can update the global version of git on the Bamboo host at this time, and it doesn't seem too easy to install an older version of git in the container.

Any suggestions? 

 

1 answer

1 accepted

0 votes
Answer accepted

I wish I'd read the error message more carefully at first. I had assumed it was having trouble with the .git/object directory in the local repo, but the path is actually the remote, which is some kind of git cache bamboo makes. That remote is in the local file system but was not mapped in the docker container.

So I mapped /var/atlassian/application-data/bamboo/xml-data/build-dir/_git-repositories-cache as a docker volume and I'm able to run git commands within the container now.

I was also mistaken in assuming that the git clone happens inside the container. It happens on the host.

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events