Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TeamCity 7.0.1 command line build step and ERRORLEVEL

I have a build step in my build configuration thats runner type "Command Line", running a custom script.

The script is executing Robocopy:

robocopy "%teamcity.build.workingDir%\Code" "\\target\d$\Web\Target Sites" /E /NP /LOG:robocopy.log

if ERRORLEVEL GEQ 4 (
"D:\blat.exe" "robocopy.log" -to [email protected] -f [email protected] -subject "Error during robocopy on TEAMCITY" -server mail.me.com
)

exit /B 0

The Robocopy command is working fine but I keep getting an email and in the build log I keep seeing:

GEQ was unexpected at this time.

The ERRORLEVEL check isn't working for some reason?

I tried IF %ERRORLEVEL% GEQ but this breaks my build has TeamCity expects me to pass a build parameter.

Does this only work as an "Executable with parameters"?

like image 461
Neil Avatar asked Feb 07 '13 16:02

Neil


People also ask

How do I add build steps in TeamCity?

In Build Steps, click Auto-detect build steps, and then select the proposed steps you want to add to the current build configuration. You can change their settings afterwards. When scanning the repository, TeamCity progressively searches for project files on the two highest levels of the source tree.

How do you run a command in TeamCity?

To open the tool's settings page, navigate to the My Settings&Tools page| TeamCity Tools side panel | Command Line Remote Run and click configure. Create a mapping configuration file: select a build configuration to run your personal build on from the dropdown with and click Add.


1 Answers

Neil, you might try escaping the percent sign.

Try IF %%ERRORLEVEL%% GEQ ...

like image 111
John Hoerr Avatar answered Sep 24 '22 15:09

John Hoerr