I am trying to setup Post-commit hook for Bitbucket to trigger Teamcity if there is any change in my repo.
Following is the shell script for it:
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
But, I am working on a Windows environment and need this script in Powershell, I tried to convert it to Powershell but it doesn't seem to work.
$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
I'm not so much familiar with Powershell scripting. Where am I going wrong with this?