I have a batch file that I use to copy a folder and it's contents to a new location, it also creates the folder name based on the date and time (and this works):
SET TODAY=%DATE:/=-%
SET NOW=%TIME::=-%
XCOPY /S /Y "C:\BuildAgent\temp\buildTmp" "C:\Automation Results\%TODAY%_%NOW%\"
I added a new Configuration Step to my Team City setup, to include this batch file. The build step is a Command Line - Custom Script:
But this has an adverse effect on the TC Agent Requirements and I cannot start my TC builds:
This issue seems to be related to TC Implicit Requirements:
http://confluence.jetbrains.com/display/TCD8/Agent+Requirements
"Implicit Requirements Any reference (name in %-signs) to an unknown parameter is considered an "implicit requirement". That means that the build will only run on the agent which provides the parameters named. Otherwise, the parameter should be made available for the build configuration by defining it on the build configuration or project levels."
How can I get around this TC conflict with % symbol which I need in my batch file?
put the contents of your build script inside a file, eg copy.bat and call this batch file from TeamCity
Addtionally, change from Custom script
to Executable with parameters
Use %%
instead of %
SET TODAY=%%DATE:/=-%%
SET NOW=%%TIME::=-%%
XCOPY /S /Y "C:\BuildAgent\temp\buildTmp" "C:\Automation Results\%%TODAY%%_%%NOW%%\"
This will ensure the variables are treated as batch file variables instead of TeamCity variables.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With