Robocopy induced error in the pipeline

948 views
Skip to first unread message

niristotle okram

unread,
Apr 17, 2016, 3:14:12 PM4/17/16
to jenkins...@googlegroups.com
Hi, 
This is not directly a jenkins issue, but i am clueless on why this is failing. All i trying to do is use robocopy (since we are using the damn-it windows) to copy over 2 files from a jenkins dir to my nodes. The part of the jenkins pipeline where its failing looks like this 

bat "robocopy %cd%${some_path1}${some_path2} ${path_to_node}\\a_folder1 file1 file2"
bat "robocopy %cd%${some_path1}${some_path3} ${path_to_node}\\a_folder2 file1 file2"
bat "robocopy %cd%${some_path1}${some_path4} ${path_to_node}\\a_folder3 file1 file2"
bat "robocopy %cd%${some_path1}${some_path5} ${path_to_node}\\a_folder4 file1 file2"

When the job comes to portion where the above code exist, it appears that the first line of robocopy is executed. And it exist. 

 






--
Regards
nirish okram

Daniel Beck

unread,
Apr 17, 2016, 4:55:21 PM4/17/16
to jenkins...@googlegroups.com

> On 17.04.2016, at 21:13, niristotle okram <nirish...@gmail.com> wrote:
>
> When the job comes to portion where the above code exist, it appears that the first line of robocopy is executed. And it exist.

Robocopy uses non-zero exit codes to indicate what it did rather than report a problem/failure -- which is likely how 'bat' interprets those. Try something like described here:

https://technet.microsoft.com/en-us/library/ff182367%28WS.10%29.aspx

You may need to use 'exit /b 0' instead if 'exit 0' for Pipeline, not sure.

niristotle okram

unread,
Apr 17, 2016, 9:30:00 PM4/17/16
to jenkins...@googlegroups.com
Thanks, yes the exit code is the cause for this. Had to change my batch lines like this 

bat "robocopy %cd%${some_path1}${some_path2} ${path_to_node}\\a_folder1 file1 file2 ^& IF %ERRORLEVEL% LEQ 1 exit 0"
bat "robocopy %cd%${some_path1}${some_path3} ${path_to_node}\\a_folder2 file1 file2 ^& IF %ERRORLEVEL% LEQ 1 exit 0"



--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/EAEE75D5-1374-4F1C-BFA1-3D0920FE1C9E%40beckweb.net.
For more options, visit https://groups.google.com/d/optout.



--
Regards
nirish okram

Wei-min Lee

unread,
Apr 19, 2016, 11:38:28 PM4/19/16
to Jenkins Users
With robocopy, exit codes 0 through 7 are considered successful codes so your compare should be LEQ 7. http://ss64.com/nt/robocopy-exit.htmlhttps://support.microsoft.com/en-us/kb/954404
Reply all
Reply to author
Forward
0 new messages