Artifact is not created if Ant pattern matches any dead symbolic link

XMLWordPrintable

    • 4
    • Severity 3 - Minor

      Summary

      Artifact is not created if Ant pattern matches any dead symbolic link

      Environment

      Unix like instances

      Steps to Reproduce

      1. Create a build plan with the following script task:
        mkdir folder
        cd folder
        ln -snf ../file file
        echo hello > another_file
        
      2. Creat an aftifact definition called Bug with the **/* pattern
      3. Run the build

      Expected Results

      1. Bamboo will ignore the dead link and add the another_file as an artifact OR
      2. Bamboo will add both dead link (if [BAM-18157] Implement a "preserve symlink" option for artifacts - Atlassian JIRA was implemented) and file as artifacts

      Actual Results

      No artifact is published and the following error happens in the server logs:

      2017-05-08 16:33:44,878 INFO [17-BAM::Default Agent::Agent:pool-32-thread-1] [AbstractArtifactManager] Publishing [Bug] for BAM-AL-JOB1-7: 2 file(s) matching [**/*] in directory /Users/dsantos/atlassian/bamboo/6.0.0/home/xml-data/build-dir/BAM-AL-JOB1
      2017-05-08 16:33:44,879 INFO [17-BAM::Default Agent::Agent:pool-32-thread-1] [AbstractArtifactManager] Trying to publish the artifact with handler: com.atlassian.bamboo.build.artifact.ServerLocalArtifactHandler
      2017-05-08 16:33:44,880 WARN [17-BAM::Default Agent::Agent:pool-32-thread-1] [AbstractArtifactManager] /Users/dsantos/atlassian/bamboo/6.0.0/home/xml-data/build-dir/BAM-AL-JOB1/file
      java.nio.file.NoSuchFileException: /Users/dsantos/atlassian/bamboo/6.0.0/home/xml-data/build-dir/BAM-AL-JOB1/file
      	at sun.nio.fs.UnixException.translateToIOException(UnixException.java:86)
      	at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
      	at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
      	at sun.nio.fs.UnixFileAttributeViews$Posix.readAttributes(UnixFileAttributeViews.java:218)
      	at sun.nio.fs.UnixFileAttributeViews$Posix.readAttributes(UnixFileAttributeViews.java:131)
      	at com.atlassian.bamboo.utils.BambooFileAttributes$ExecutablePermissionGetter.visitPosix(BambooFileAttributes.java:159)
      	at com.atlassian.bamboo.utils.BambooFileAttributes$FileAttributeVisitor.accept(BambooFileAttributes.java:42)
      	at com.atlassian.bamboo.utils.BambooFiles.isExecutable(BambooFiles.java:79)
      	at com.atlassian.bamboo.build.artifact.FileTransferTask.execute(FileTransferTask.java:33)
      	at com.atlassian.bamboo.build.artifact.ArtifactHandlingUtils.transferFileSet(ArtifactHandlingUtils.java:89)
      	at com.atlassian.bamboo.build.artifact.ArtifactHandlingUtils.copyFileSet(ArtifactHandlingUtils.java:73)
      	at com.atlassian.bamboo.build.artifact.AbstractLocalArtifactHandler.publish(AbstractLocalArtifactHandler.java:56)
      	at com.atlassian.bamboo.build.artifact.ServerLocalArtifactHandler.publish(ServerLocalArtifactHandler.java:32)
      	at com.atlassian.bamboo.build.artifact.handlers.ArtifactHandlerPackagingDecorator.publish(ArtifactHandlerPackagingDecorator.java:96)
      	at com.atlassian.bamboo.build.artifact.AbstractArtifactManager$1.call(AbstractArtifactManager.java:230)
      	at com.atlassian.bamboo.build.artifact.AbstractArtifactManager$1.call(AbstractArtifactManager.java:223)
      	at com.atlassian.bamboo.plugin.BambooPluginUtils.callUnsafeCode(BambooPluginUtils.java:57)
      	at com.atlassian.bamboo.build.artifact.AbstractArtifactManager.publishFileSet(AbstractArtifactManager.java:222)
      	at com.atlassian.bamboo.build.artifact.AbstractArtifactManager.publish(AbstractArtifactManager.java:119)
      	at com.atlassian.bamboo.build.artifact.BuildArtifactPostProcessor.call(BuildArtifactPostProcessor.java:79)
      	at com.atlassian.bamboo.build.pipeline.tasks.ExecuteBuildTask.performCustomBuildProcess(ExecuteBuildTask.java:158)
      	at com.atlassian.bamboo.build.pipeline.tasks.ExecuteBuildTask.call(ExecuteBuildTask.java:79)
      	at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent.build(DefaultBuildAgent.java:216)
      	at com.atlassian.bamboo.v2.build.agent.BuildAgentControllerImpl$1.call(BuildAgentControllerImpl.java:136)
      	at com.atlassian.bamboo.v2.build.agent.BuildAgentControllerImpl$1.call(BuildAgentControllerImpl.java:127)
      	at com.atlassian.bamboo.variable.CustomVariableContextImpl.withVariableSubstitutor(CustomVariableContextImpl.java:222)
      	at com.atlassian.bamboo.v2.build.agent.BuildAgentControllerImpl.waitAndPerformBuild(BuildAgentControllerImpl.java:126)
      	at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent$1.run(DefaultBuildAgent.java:138)
      	at com.atlassian.bamboo.utils.BambooRunnables$1.run(BambooRunnables.java:51)
      	at com.atlassian.bamboo.security.ImpersonationHelper.runWith(ImpersonationHelper.java:31)
      	at com.atlassian.bamboo.security.ImpersonationHelper.runWithSystemAuthority(ImpersonationHelper.java:20)
      	at com.atlassian.bamboo.security.ImpersonationHelper$1.run(ImpersonationHelper.java:52)
      	at java.lang.Thread.run(Thread.java:745)
      

      Note

      Tested in 5.14.3.1 and the artifact was published including only the file another_file. The dead link was ignored.

      Workaround

      1. Remove any dead links that may match the artifact definition
      2. Create a more specific pattern for artifacts so they don't match any dead link

            Assignee:
            Unassigned
            Reporter:
            Daniel Santos (Inactive)
            Votes:
            2 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: