batch-filejenkinscwrsync

cwrsync isn't working under jenkins


I'm using cwrsync with cygdrive notation to refer disk drives. In usual cmd (or batch file) it works perfectly, but when bat-file with rsync invocation is used inside jenkins environment (I mean when jenkins slave runs this bat-file) rsync gives errors like:

rsync: change_dir "/cygdrive/q/build" failed: No such file or directory (2)

In which direction should I dig?

PS. rsync version is 3.1.1, bundled-in cygwin 1.7.32; on windows server 2012.

UPD. Q is related to network-mapped drive.


Solution

  • I figured out that network drives in windows is kind of user-related. And as long as jenkins doesn't use regular user you're working from -- it won't see any network-mapped drives if they're not somehow is globally-visible.

    So, solution is to automatically execute command to map network drive as SYSTEM user (which is used by jenkins): so that purpose I created bat file which does following:

    net use Q: \\host\sharename /persistent:no
    

    and launch it from SYSTEM user by scheduled task (triggered by network becoming available) -- see this question.

    NOTE: /persistent:yes is not working for some reason.