1

So, I wrote a simple batch file which will update a directory lets say ../../sqlscripts and copied svn.exe to the directory where my .bat file is, so that I can call svn update in that batch files to update a particular folder. Here is the content of the batch file

svn update ../../sqlscripts

when I am executing this batch script from CMD it is getting executed and updating the folder ../../sqlscripts. But the issue comes when I am executing the batch script from jenkins. Folder ../../sqlscripts is not getting updated and I am having this log in jenkins

Skipped '..\..\sqlscripts'
Summary of conflicts:
  Skipped paths: 1

I am not able to figure out what the issue is, rest of the line of the batch files are being executed as expected.

viveksinghggits
  • 661
  • 14
  • 35
  • Did u check the working directory is correct? (CD - current directory) – marsze Jul 13 '16 at 07:42
  • @marsze directory is correct, it is working fine if I am executing through CMD – viveksinghggits Jul 13 '16 at 07:46
  • 1
    http://stackoverflow.com/questions/3048662/svn-skipped-paths – marsze Jul 13 '16 at 07:48
  • that answer is not helping in this case @marsze – viveksinghggits Jul 13 '16 at 07:50
  • 2
    Since your batch only contains one single line with a relative path it heavily depends on where and from where u execute it. Try a full path just for fun to see if that works. If it does, you know where to start looking. – marsze Jul 13 '16 at 07:53
  • I got it, I just changed the line svn update `../../sqlscripts` to absolute path `svn update D:\QAENVs\R16.4\sqlscripts` and its working fine. The conscusion whenever you are trying to execute the batch file from jenkins always use absolute paths otherwise its not going to work. – viveksinghggits Jul 13 '16 at 07:54
  • ...or set the working directory properly. E.g. add `cd "%~dp0"` at the beginning of the batch. This will set the working directory to the one the batch resides in. – marsze Jul 13 '16 at 07:56
  • I am glad you found an answer. I am not sure it is advisable to copy svn.exe to another directory. Can it run from where it was installed? Must you keep it out of the PATH? – lit Jul 13 '16 at 12:36
  • @Liturgist same thought came to my mind also, but I didn't find any way to update a dir in batch script that why I used this work around. Its not good practice I think. – viveksinghggits Jul 13 '16 at 14:01
  • 1
    If the directory containing `svn.exe` is in the PATH variable, then you do not need to put it into the current directory. Since you know a fully qualified path to copy `svn.exe` from, you could use that if the directory cannot be in the PATH variable. – lit Jul 13 '16 at 20:33

0 Answers0