Uploaded image for project: 'Bamboo Data Center'
  1. Bamboo Data Center
  2. BAM-25825

Sftp artifact handler's compression does not work with symlinks

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Low Low
    • None
    • 9.6.1
    • Artifacts
    • None

      Issue Summary

      This is reproducible on Data Center: (yes)

      Compression for SFTP artifact handler fails to compress artifacts with symlinks that point to files outside of the specific root folder of the artifact definition mask.

      Steps to Reproduce

      1. In a job with artifact definition
        • locaton: packages/folder
        • copy patern: {}/{*}
      1. create a symlink within the artifact location that points to a file in the parent folder. Example:
        cd  packages/folder
        ls -s ../../file.json file.json
        

      Expected Results

      The artifact should be generated with the linked file included.

      ( Same artifact definition works with Bamboo server artifact handler and when the compression is disabled.)

      Actual Results

      Artifact compression and upload fails with:

      2024-07-10 11:07:08,431 WARN [0-BAM::Elastic Agent on i-sssss::Agent:Thread-35] [AbstractArtifactManager] File /home/bamboo/bamboo-agent-home/xml-data/build-dir/PROJ-PLAN-JOB/FILE.json not contained within parent directory /home/bamboo/bamboo-agent-home/xml-data/build-dir/PROJ-PLAN-JOB/packages/folder
      java.lang.IllegalArgumentException: File /home/bamboo/bamboo-agent-home/xml-data/build-dir/PROJ-PLAN-JOB/FILE.json not contained within parent directory /home/bamboo/bamboo-agent-home/xml-data/build-dir/PROJ-PLAN-JOB/packages/folder
      	at com.google.common.base.Preconditions.checkArgument(Preconditions.java:445) ~[guava-32.1.3-jre.jar:?]
      	at com.atlassian.bamboo.utils.archive.ArchiveUtils.compressFiles(ArchiveUtils.java:47) ~[atlassian-bamboo-core-9.6.1.jar:?]
      	at com.atlassian.bamboo.build.artifact.handlers.ArtifactHandlerPackagingDecorator.publish(ArtifactHandlerPackagingDecorator.java:105) ~[atlassian-bamboo-core-9.6.1.jar:?]
      	at com.atlassian.bamboo.build.artifact.AbstractArtifactManager$2.lambda$call$0(AbstractArtifactManager.java:306) ~[atlassian-bamboo-core-9.6.1.jar:?]
      	at com.atlassian.bamboo.utils.BambooCallables.callUnchecked(BambooCallables.java:34) ~[atlassian-bamboo-api-9.6.1.jar:?]
      	at com.atlassian.bamboo.plugin.BambooPluginUtils.callChangedApi(BambooPluginUtils.java:240) ~[atlassian-bamboo-core-9.6.1.jar:?]
      	at com.atlassian.bamboo.build.artifact.AbstractArtifactManager$2.call(AbstractArtifactManager.java:305) ~[atlassian-bamboo-core-9.6.1.jar:?]
      	at com.atlassian.bamboo.build.artifact.AbstractArtifactManager$2.call(AbstractArtifactManager.java:300) ~[atlassian-bamboo-core-9.6.1.jar:?]
      	at com.atlassian.bamboo.plugin.BambooPluginUtils.callUnsafeCode(BambooPluginUtils.java:55) ~[atlassian-bamboo-core-9.6.1.jar:?]
      	at com.atlassian.bamboo.build.artifact.AbstractArtifactManager.publishFileSet(AbstractArtifactManager.java:300) ~[atlassian-bamboo-core-9.6.1.jar:?]
      	at com.atlassian.bamboo.build.artifact.AbstractArtifactManager.publish(AbstractArtifactManager.java:123) ~[atlassian-bamboo-core-9.6.1.jar:?]
      	at com.atlassian.bamboo.build.artifact.AbstractArtifactManager.publish(AbstractArtifactManager.java:92) ~[atlassian-bamboo-core-9.6.1.jar:?]
      	at com.atlassian.bamboo.build.artifact.BuildArtifactPostProcessor.call(BuildArtifactPostProcessor.java:74) ~[atlassian-bamboo-core-9.6.1.jar:?]
      	at com.atlassian.bamboo.build.pipeline.tasks.ExecuteBuildTask.performCustomBuildProcess(ExecuteBuildTask.java:142) ~[atlassian-bamboo-core-9.6.1.jar:?]
      	at com.atlassian.bamboo.build.pipeline.tasks.ExecuteBuildTask.call(ExecuteBuildTask.java:82) ~[atlassian-bamboo-core-9.6.1.jar:?]
      	at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent.executeBuildPhase(DefaultBuildAgent.java:242) ~[atlassian-bamboo-agent-core-9.6.1.jar:?]
      	at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent.build(DefaultBuildAgent.java:214) ~[atlassian-bamboo-agent-core-9.6.1.jar:?]
      	at com.atlassian.bamboo.v2.build.agent.BuildAgentControllerImpl.lambda$waitAndPerformBuild$0(BuildAgentControllerImpl.java:168) ~[atlassian-bamboo-agent-core-9.6.1.jar:?]
      	at com.atlassian.bamboo.variable.CustomVariableContextImpl.withVariableSubstitutor(CustomVariableContextImpl.java:115) ~[atlassian-bamboo-core-9.6.1.jar:?]
      	at com.atlassian.bamboo.v2.build.agent.BuildAgentControllerImpl.waitAndPerformBuild(BuildAgentControllerImpl.java:161) ~[atlassian-bamboo-agent-core-9.6.1.jar:?]
      	at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent.lambda$start$0(DefaultBuildAgent.java:159) ~[atlassian-bamboo-agent-core-9.6.1.jar:?]
      	at com.atlassian.bamboo.utils.BambooRunnables$1.run(BambooRunnables.java:48) ~[atlassian-bamboo-api-9.6.1.jar:?]
      	at com.atlassian.bamboo.security.ImpersonationHelper.runWith(ImpersonationHelper.java:26) ~[atlassian-bamboo-api-9.6.1.jar:?]
      	at com.atlassian.bamboo.security.ImpersonationHelper.runWithSystemAuthority(ImpersonationHelper.java:17) ~[atlassian-bamboo-api-9.6.1.jar:?]
      	at com.atlassian.bamboo.security.ImpersonationHelper.lambda$makeRunnableWithSystemAuthority$0(ImpersonationHelper.java:38) ~[atlassian-bamboo-api-9.6.1.jar:?]
      	at java.lang.Thread.run(Thread.java:829) ~[?:?]
      

      Workaround

      Add a script task to the job that compresses the artifact before the transfer.

      Alternative Workaround

      Increase the Package threshold for sftp artifact handler in order to avoid compression.

      Package threshold  can be changed in CogIcon > Overview > Artifact handlers > SFTP artifact handler > advanced options

       

      Currently there is no known workaround for this behavior. A workaround will be added here when available

            Unassigned Unassigned
            sorlovski Zaro
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: