Artifact publish failing: "too many levels of symbolic links"
Problem
Artifact publishing task takes a lot of time to be processed and fail at the end with no clear reason declared on build logs.
The following messages can be seen in the atlassian-bamboo-agent.log
INFO | jvm 8 | 2018/07/18 12:25:22 | skipping symbolic link <Bamboo_agent_home>/xml-data/build-dir/PLAN-KEY/folder/folder/folder/folder/folder -- too many levels of symbolic links.
INFO | jvm 8 | 2018/07/18 12:25:24 | skipping symbolic link <Bamboo_agent_home>/xml-data/build-dir/PLAN-KEY/folder/folder/folder/folder/folder/sub/sub/sub/sub/sub/sub -- too many levels of symbolic links.
...
INFO | jvm 8 | 2018/07/18 12:31:59 | 2018-07-18 12:31:59,099 WARN [0-BAM::agent123.company.com::Agent:pool-3-thread-1] [ArtifactStreams] Error during artifact transfer, total bytes written: 876544, total requested: 975688, latest request: 975688
INFO | jvm 8 | 2018/07/18 12:31:59 | 2018-07-18 12:31:59,099 INFO [0-BAM::agent123.company.com::Agent:pool-3-thread-1] [RetryExec] I/O exception (java.net.SocketException) caught when processing request to {}->http://bamboo.company.com:8085: Broken pipe
INFO | jvm 8 | 2018/07/18 12:31:59 | 2018-07-18 12:31:59,099 INFO [0-BAM::agent123.company.com::Agent:pool-3-thread-1] [RetryExec] Retrying request to {}->http://bamboo.company.com:8085
...
INFO | jvm 8 | 2018/07/18 12:33:15 | 2018-07-18 12:33:15,884 WARN [0-BAM::agent123.company.com::Agent:pool-3-thread-1] [ArtifactStreams] Error during artifact transfer, total bytes written: 876544, total requested: 975688, latest request: 975688
INFO | jvm 8 | 2018/07/18 12:33:15 | 2018-07-18 12:33:15,884 ERROR [0-BAM::agent123.company.com::Agent:pool-3-thread-1] [BambooArtifactHttpTransport] Failed to send artifact.
INFO | jvm 8 | 2018/07/18 12:33:15 | java.net.SocketException: Broken pipe
INFO | jvm 8 | 2018/07/18 12:33:15 | at java.net.SocketOutputStream.socketWrite0(Native Method)
INFO | jvm 8 | 2018/07/18 12:33:15 | at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:109)
INFO | jvm 8 | 2018/07/18 12:33:15 | at java.net.SocketOutputStream.write(SocketOutputStream.java:153)
INFO | jvm 8 | 2018/07/18 12:33:15 | at org.apache.http.impl.io.SessionOutputBufferImpl.streamWrite(SessionOutputBufferImpl.java:124)
Cause
The build data has symbolic links pointing to a lower part of the same build directory data structure and the artifact definition value defined for the Copy pattern field is using **/. The artifact definition patten causes a recursive search and due to the symbolic links this search is running in loops.
Workaround
Avoid using the **/ Ant pattern on the Copy pattern field at artifact definition . An absolute path should solve the problem.
Resolution
Make sure there are no symbolic links pointing the a lower part of the same repository three. This will save the artifact search from loops.