Jenkins copy directories/files in a build

I am trying to copy files out to a network directory during a build, and I keep getting a ” No such file or directory” error message.

Copying to local drive works fine:
cp -Rf c:/Jenkins/deployments/TW_ISSUE_A/src c:/Jenkins/deployments/TW_ISSUE_A/target

  • Building PhantomJS-2 from source on Windows
  • Does Git, SVN, etc do this type of “branching & merging” or something like this?
  • Generating API documents in Git Workflow
  • How to mark a build unstable in Jenkins when running shell scripts
  • 404 error when building Git project in TFS2013
  • Set git tag and checkout on Windows
  • The following all throw the same message:

    • cp -Rf c:/Jenkins/deployments/TW_ISSUE_A/src H:/some_dir

    • cp -Rf c:/Jenkins/deployments/TW_ISSUE_A/src H:\some_dir

    • cp -Rf c:/Jenkins/deployments/TW_ISSUE_A/src //Hubbell/MISGenl/some_dir

    • cd c:/Jenkins/deployments/TW_ISSUE_A/src
      rsync -avuzb //Hubbell/MISGenl/Projects/Tronweb/TronwebBuilds/test/ora/sql/

    • cp -Rf c:/Jenkins/deployments/TW_ISSUE_A/src /cygdrive/h/some_dir

    I’ve even created a shell script to call from Jenkins, but I continue to receive that message.

    #fetch the artifacts
    (cd "$remote_stage_dir" && wget "$url" && tar xvf build-TW_ISSUE_A_BUILD.tar dat
     java ora && rm -rf *.tar && cp -r ./ora/* ../INTEGRATION)

    Is there any way to copy files out to a mapped drive on the build machine?

    Thank you!!

  • How to read the “Git Build Data” in Jenkins?
  • Selenium tests fail when run by Jenkins, but succeed when run by command line
  • Bitbucket Build Erring after triggered from Commit
  • jenkins + sonar + github integration
  • Sending Cppcheck result/report on email from Jenkins using email-ext plugin
  • Running Bower from Jenkins git configuration
  • One Solution collect form web for “Jenkins copy directories/files in a build”

    I would guess the mapped drive isn’t available in the services context, or that the user executing Jenkins doesn’t have access to it. What user is Jenkins running as?

    I think your problem has two aspects:

    1. The user running the Jenkins service isn’t allowed to connect to the network.
    2. h: isn’t known to the user.

    If you haven’t modified it, the service is most likely running under the LocalSystem account. You can modify this by running services.msc (or navigate to services via the Windows control panel) and locating the jenkins service. This should resolve the first problem.

    The second problem can be resolved by using UNC paths (as you tried above) instead of network drives.

    The Jenkins wiki has an article about problems like this: My software builds on my computer but not on Jenkins

    Git Baby is a git and github fan, let's start git clone.