Bamboo Remote Agent Always Reports Build Failed Even Though Successful
Asked by Justin Bleach:

I've setup a remote bamboo agent on another RHEL 7 VM in my organization.

When it runs our build on the remote agent the build itself completes successfully but the agent or bamboo server reports the build failed.

When I run the same build with the default agent (bamboo server) which runs on another RHEL 7 VM the build works and is reported as successful.

I've done some research and looked into the Broker Configuration for Bamboo Server. I changed the remote agent port to 8707 after finding out that our IT security team limits ports to 8000-8999.

Even after the change to 8707 the build is still reported as failed even though it is successful.

I don't know what information to provide other than here is how I run the remote agent on the other box:

java -Dbamboo.home=/data/atlassian/application-data/bamboo -jar atlassian-bamboo-agent-installer-5.15.0.1.jar \<removed\> start


Answers:
author: Justin Bleach
body: I just got the agent to build successfully. One of the tasks we have was causing it to fail but it was not mentioned in the build output.

The Junit Parser task fails on the remote agent VM but not the default Bamboo server VM. I'll have to look into why that is. I'm sure it's something Linux specific.

Thanks again for your time!


author: Jeyanthan I
body: Hi Justin,

What do you see in the *build log* and in atlassian*-bamboo-agent.log* when you run from the remote agent? I hope that gives you a hint on what's happening.

Also, to confirm things, I would just run the same build manually from the remote agent machine and see if it executes successfully.

comments: author: Justin Bleach
body: I don't see anything out of the ordinary in the logs for the remote agent. No stack traces or WARN's or ERROR's.

Here are the last lines from the build log that was built with the agent:

```
16-Aug-2017 10:59:51 Finalising the build...
16-Aug-2017 10:59:51 Stopping timer.
16-Aug-2017 10:59:51 Build MANAGER-EDM2-JOB1-130 completed.
16-Aug-2017 10:59:52 Running on server: post build plugin 'NCover Results Collector'
16-Aug-2017 10:59:52 Running on server: post build plugin 'Build Hanging Detection Configuration'
16-Aug-2017 10:59:52 Running on server: post build plugin 'Clover Delta Calculator'
16-Aug-2017 10:59:52 Running on server: post build plugin 'Maven Dependencies Postprocessor'
16-Aug-2017 10:59:52 All post build plugins have finished
16-Aug-2017 10:59:52 Generating build results summary...
16-Aug-2017 10:59:52 Saving build results to disk...
16-Aug-2017 10:59:52 Logging substituted variables...
16-Aug-2017 10:59:52 Indexing build results...
16-Aug-2017 10:59:52 Finished building MANAGER-EDM2-JOB1-130.
```


author: Jeyanthan I
body: Hi Justin, I see you have just shared the last few lines of the build log. You may have to check few lines above and see if all the tasks got executed successfully (with exit 0, as Bamboo just looks for exit code and decides if the build has to be a success or failure).

Then, compare the same with the build log from your local agent. If they both are identical, check your bamboo server log for hints (especially catalina.out and atlassian-bamboo.log)


author: Justin Bleach
body: All tasks were executed successfully and there are no non-zero exit codes. I compared a build log from the default agent and the remote agent and they are the same.

I also manually ran 'gradle build' on the remote agent VM and it completed successfully.

Are there any other logs that would help you? I'm at a loss why the remote agent is reporting a failure or why Bamboo server thinks the build is a failure.


author: Justin Bleach
body: One other thing. I'm running the remote agent java wrapper as user 'bamboo' and all the file permissions under the bamboo home I specified are owned by 'bamboo:bamboo'


author: Justin Bleach
body: I have a reverse httpd(apache 2.4) proxy in front of Bamboo. Not sure how that affects the agent running on 8707. Here is the httpd config:

```
  <Proxy *>
 Require all granted
 </Proxy>

ProxyPass /bamboo http://myserver:8085/bamboo
 ProxyPassReverse /bamboo http://myserver:8085/bamboo
```

I checked out [this](https://confluence.atlassian.com/kb/integrating-apache-http-server-reverse-proxy-with-bamboo-753894403.html) and but I didn't see anything about the remote agent.

When the agent runs I see this in the output:

```
BAMBOO_SERVER: http://myserver/bamboo/agentServer/
```

And here are the last few lines of the agent run:

```
HOME: /export/home/bamboo
_: /bin/java
Running [/data/atlassian/application-data/bamboo/bin/bamboo-agent.sh, start]
Agent process started, shutdown hook registered, proceeding with log pump...
Starting Bamboo Agent...
Waiting for the agent process to finish...
Underlying agent process has terminated cleanly,
Bamboo Agent Installer is shutting down, the underlying agent process has already been shut down.?
```


Tags: remote-agent