简体   繁体   中英

Teamcity with Subversion post commit script on windows

We would like Teamcity to build our solutions on every commit into subversion. Following the documentation, we are to create a .sh script :-

SERVER=https://buildserver-url
USER=buildserver-user
PASS="<password>"

LOCATOR=$1

# The following is one-line:
(sleep 10;  curl --user $USER:$PASS -X POST "$SERVER/app/rest/vcs-root-instances/commitHookNotification?locator=$LOCATOR" -o /dev/null) >/dev/null 2>&1 <&1 &

exit 0

Subversion is running on a windows environment, and so the .sh file will fail. We are trying to convert this into a .bat file of which we have :-

set SERVER=https://buildserver-url
set USER=buildserver
set PASS=password

LOCATOR=%1%

(timeout 10;  curl --user %USER%:%PASS% -X POST "%SERVER%/app/rest/vcs-root-instances/commitHookNotification?locator=%LOCATOR%" -o /dev/null) >/dev/null 2>%1% <%1% &

exit 0

However, this is still failing when trying to execute with

"The system cannot find the path specified"

It seems that perhaps we havnt converted this correctly?

Are the programs you're referencing (such as curl and timeout.exe ) in locations that are present in the $PATH / %PATH% variable? How about any other files you're referencing - are you specifying full paths

Side note: Did you install curl and timeout.exe on the Windows server?

Also, /dev/null does not exist on Windows; you need to redirect to NUL . You can't just change the file extension and some of your syntax and expect a bash script to work on Windows.

Were I in your shoes, I'd skip batch altogether and write the script in something modern and sane like Powershell.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM