How to robocopy to shared file via jenkins?

0

I have a single project running that has robocopy command in it. What I am trying to do here is

  • Download Files from github to Server A (Workspace) via Jenkins << Where Jenkins is installed
  • Robocopy the Workspace to Server B (Network Destination)

Problem

The problem that I have encounter was even though when I run jenkins as admin by adjusting option in Windows Services. However, I am keep getting Error Message

It sounds very simple and I have tested it with local destination easily but I am having a problem when I use network destinations. These are the batch command that I have used in this project.

On Jenkins I have THESE codes as a windows batch command

robocopy "D:\JENKINS\jobs\****\workspace\JAVAS\Publish" "T:\backup" /E /XD dir "D:\CICOM\JENKINS\jobs\CICOM_GLAM_LOCAL_TEST\Publish\publish" /XF web.config /XF appsettings.json /XF appsettings.Development.json
@echo robocopy exit code: %ERRORLEVEL%
@if %ERRORLEVEL% GTR 3 ( echo robocopy ERROR )
@if %ERRORLEVEL% GTR 3 ( exit %ERRORLEVEL% )
@set ERRORLEVEL=0

As you can see the destination for the code is to "T:\backup" Originally, the destination is should be "\192.168.7.***\Users\Admin\Desktop" I mapped the folder so that I could use T: drive as a destination.

However, when I use that command on CMD or make that command as a batch file and RUN , it all WORKS.

However, as soon as run that command on jenkins, it doesn't work. and I get these messages

-------------------------------------------------------------------------------
   ROBOCOPY     ::     Robust File Copy for Windows                              
-------------------------------------------------------------------------------

  Started : Tuesday, May 7, 2019 2:44:04 PM
2019/05/07 14:44:04 ERROR 3 (0x00000003) Getting File System Type of Destination T:\backup\
The system cannot find the path specified.


   Source : D:\***\JENKINS\jobs\*****\workspace\JAVAS\Publish\
     Dest - T:\backup\

    Files : *.*

Exc Files : web.config
        appsettings.json
        appsettings.Development.json

 Exc Dirs : dir
        D:\***\JENKINS\jobs\*****\Publish\publish

  Options : *.* /S /E /DCOPY:DA /COPY:DAT /R:1000000 /W:30 

------------------------------------------------------------------------------

2019/05/07 14:44:04 ERROR 3 (0x00000003) Creating Destination Directory T:\backup\
The system cannot find the path specified.

robocopy exit code: 16
robocopy ERROR 
Build step 'Execute Windows batch command' marked build as failure
Finished: FAILURE

I'm currently stuck here and cannot understand why this is happening. I was googling why and did all the troubleshooting such as giving jenkins a permission (as admin) but nothing has been worked.

Anybody Help?

jenkins
jenkins-cli
asked on Stack Overflow May 8, 2019 by Yunku Kang

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0