I'm a long time JIRA user. I've started a new job, and we decided to get JIRA, Bamboo and Bitbucket, for a fully integrated experience.
JIRA and Bitbucket are all configured nicely, and working perfectly.
Bamboo is a different matter. I've fallen at the (almost) first hurdle.
We've decided to try building in Docker, so we've created our own Docker image, based on the Atlassian Docker Agent image, with the addition of Maven and Ant. This has been pushed to a Docker repos in the Bamboo machine. Docker is installed on the Bamboo machine, and all works as expected.
I've created a linked repository, and all is well.
When I try to build the plan which uses the Docker agent, it fails instantly as soon as it calls "mvn clean install", it returns with a result code 137, which could be anything between "no", and a memory error. It's not like it gets halfway through the build, it's an immediate failure.
simple 28-Apr-2021 19:34:15 Starting task 'Clean and Install' of type 'com.atlassian.bamboo.plugins.maven:task.builder.mvn3'
command 28-Apr-2021 19:34:15 Beginning to execute external process for build 'SIM Quality of Experience - SIMQOE Plan - Default Job #6 (SIMQOE-SP-JOB1-6)'\n ... running command line: \n/home/bamboo/atlassian-bamboo-7.2.1/temp/runInDocker2427305850259878450.sh /usr/share/maven/bin/mvn --batch-mode clean install\n ... in: /home/bamboo/atlassian-bamboo-7.2.1/temp\n
simple 28-Apr-2021 19:34:17 Failing task since return code of [/home/bamboo/atlassian-bamboo-7.2.1/temp/runInDocker2427305850259878450.sh /usr/share/maven/bin/mvn --batch-mode clean install] was 137 while expected 0
simple 28-Apr-2021 19:34:17 Finished task 'Clean and Install' with result: Failed
It only fails when calling maven in docker, from Bamboo. The only substantive difference is
which calls maven.
Because it fails so quickly, it tidies up the files, and deletes the temp file, so I don't know what's going on.
Have I missed anything?
I think I've found the issue:
Make sure your Bamboo server is running and has remote agents support enabled. To enable it:
I tried rebuilding the docker agent to use localhost, but when it starts up, it complains (correctly) that there is already an agent running on the machine.
Looks like I'm building locally for now!
To be honest - I don't know.
I set up the plan, selected "Docker", entered the fully qualified local registry name (192.168.80.19:5000/build_agent). It's got the default shared volumes (Bamboo temp & working directories)
The agent config itself is pretty much the default.
I've added a Docker capability to this agent.
The JDK and Maven paths are common to the agent and host, so they're shared
Does this help?
Thanks for your assistance!
I've done some more investigating.
I don't believe the problem is with maven itself.
I stripped everything back to basics. I removed the maven build step, and replaced it with a script step which just did pwd & ls -la.
This failed with a permission denied error. I modified the docker config to add
This then worked. I was able to pwd and ls. Everything seemed to be in place and correct - the source was present.
I then extended the script to check for free memory - the VM was only 4Gb, so we bumped that up to 8. Once that was done, we had >5Gb available according to free -m.
This is then where things get strange.
If I try to run any command which takes more than a second or so to run, it exits immediately with return code 137. When I thought maven was returning with 137, it was actually the calling script.
If I try to "sleep 2m", or "free -m -s 1 -c 10", it gets about 2 seconds in, then the script exits.
The dockerfile is
RUN apt-get update
RUN apt-get install maven -y
RUN apt-get install git -y
RUN apt-get install ant -y
and the docker-compose is
I'm completely stuck just now.