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

SCP Transfer to a windows target results in No such file or directory error

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Low Low
    • None
    • 6.9.2, 8.2.3
    • SCP and SSH tasks
    • None

      Issue Summary

      This is reproducible on Data Center: (yes) / (no)

      Steps to Reproduce

      1. Install OpenSSH on Windows
      2. Create a target directory and ensure that the user, System, and Administrator have full control to the directory.
      3. Configure a SCP task in Bamboo
      4. Run the plan

      When run directly on the remote agent the SCP command is able to upload the file to the target machine & directory.

      Expected Results

      The file is uploaded to the target machine & directory

      Actual Results

      The below exception is thrown in the build log:

      02-Jun-2022 11:02:56 net.schmizz.sshj.xfer.scp.SCPRemoteException: Remote SCP command had error: scp: 'D:/BambooTest/': No such file or directory
      02-Jun-2022 11:02:56 at net.schmizz.sshj.xfer.scp.SCPEngine.check(SCPEngine.java:73)
      02-Jun-2022 11:02:56 at net.schmizz.sshj.xfer.scp.SCPEngine.sendMessage(SCPEngine.java:133)
      02-Jun-2022 11:02:56 at net.schmizz.sshj.xfer.scp.SCPUploadClient.sendFile(SCPUploadClient.java:97)
      02-Jun-2022 11:02:56 at net.schmizz.sshj.xfer.scp.SCPUploadClient.process(SCPUploadClient.java:78)
      02-Jun-2022 11:02:56 at net.schmizz.sshj.xfer.scp.SCPUploadClient.startCopy(SCPUploadClient.java:70)
      02-Jun-2022 11:02:56 at net.schmizz.sshj.xfer.scp.SCPUploadClient.copy(SCPUploadClient.java:50)
      02-Jun-2022 11:02:56 at net.schmizz.sshj.xfer.scp.SCPUploadClient.copy(SCPUploadClient.java:43)
      02-Jun-2022 11:02:56 at net.schmizz.sshj.xfer.scp.SCPFileTransfer.upload(SCPFileTransfer.java:55)
      02-Jun-2022 11:02:56 at com.atlassian.bamboo.plugins.scp.ScpTask.transferFiles(ScpTask.java:364)
      02-Jun-2022 11:02:56 at com.atlassian.bamboo.plugins.scp.ScpTask.execute(ScpTask.java:271)
      02-Jun-2022 11:02:56 at com.atlassian.bamboo.plugins.scp.ScpTask.run(ScpTask.java:121)
      02-Jun-2022 11:02:56 at com.atlassian.bamboo.plugins.scp.ScpTask.execute(ScpTask.java:107)
      02-Jun-2022 11:02:56 at com.atlassian.bamboo.task.TaskExecutorImpl.lambda$executeTasks$1(TaskExecutorImpl.java:315)
      02-Jun-2022 11:02:56 at com.atlassian.bamboo.task.TaskExecutorImpl.executeTaskWithPrePostActions(TaskExecutorImpl.java:252)
      02-Jun-2022 11:02:56 at com.atlassian.bamboo.task.TaskExecutorImpl.executeTasks(TaskExecutorImpl.java:315)
      02-Jun-2022 11:02:56 at com.atlassian.bamboo.task.TaskExecutorImpl.execute(TaskExecutorImpl.java:112)
      02-Jun-2022 11:02:56 at com.atlassian.bamboo.build.pipeline.tasks.ExecuteBuildTask.call(ExecuteBuildTask.java:73)
      02-Jun-2022 11:02:56 at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent.executeBuildPhase(DefaultBuildAgent.java:204)
      02-Jun-2022 11:02:56 at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent.build(DefaultBuildAgent.java:176)
      02-Jun-2022 11:02:56 at com.atlassian.bamboo.v2.build.agent.BuildAgentControllerImpl.lambda$waitAndPerformBuild$0(BuildAgentControllerImpl.java:131)
      02-Jun-2022 11:02:56 at com.atlassian.bamboo.variable.CustomVariableContextImpl.withVariableSubstitutor(CustomVariableContextImpl.java:185)
      02-Jun-2022 11:02:56 at com.atlassian.bamboo.v2.build.agent.BuildAgentControllerImpl.waitAndPerformBuild(BuildAgentControllerImpl.java:125)
      02-Jun-2022 11:02:56 at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent$1.run(DefaultBuildAgent.java:127)
      02-Jun-2022 11:02:56 at com.atlassian.bamboo.utils.BambooRunnables$1.run(BambooRunnables.java:48)
      02-Jun-2022 11:02:56 at com.atlassian.bamboo.security.ImpersonationHelper.runWith(ImpersonationHelper.java:26)
      02-Jun-2022 11:02:56 at com.atlassian.bamboo.security.ImpersonationHelper.runWithSystemAuthority(ImpersonationHelper.java:17)
      02-Jun-2022 11:02:56 at com.atlassian.bamboo.security.ImpersonationHelper$1.run(ImpersonationHelper.java:41)
      02-Jun-2022 11:02:56 at java.lang.Thread.run(Thread.java:748)
      02-Jun-2022 11:02:56 Copy Failed. Some files were not uploaded successfully.Options 

      Workaround

      Set PowerShell as the default Windows shell for SSH:

      Run this from an Administrator Powershell session
      New-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" -Name DefaultShell -Value "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -PropertyType String -Force
      

      More information: Configuring the default shell for OpenSSH in Windows

              Unassigned Unassigned
              fe7fd6f6c69e James Williams
              Votes:
              1 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated: