TeamCity conflict with% symbol in the command line step

I have a batch file that I use to copy a folder and its contents to a new location, it also creates a folder name based on 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 City City team to include this batch file. The build step is the command line - Custom Script:

Build step

But this adversely affects the requirements of the TS agent, and I can not start my TC builds:

Agent requirements

This problem seems to be related to TS 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. ”This means that the assembly will work only on the agent that provides the named parameters. Otherwise, the parameter must be accessible for the assembly configuration, defining it at the build configuration level or project level. "

How can I get around this TC conflict with the% symbol that I need in my batch file?

+8
teamcity
source share
2 answers

Use %% instead of %

 SET TODAY=%%DATE:/=-%% SET NOW=%%TIME::=-%% XCOPY /S /Y "C:\BuildAgent\temp\buildTmp" "C:\Automation Results\%%TODAY%%_%%NOW%%\" 

This ensures that the variables are treated as batch file variables instead of TeamCity variables.

+12
source share

put the contents of your script assembly inside a file, for example copy.bat, and call this batch file from TeamCity

Add, change from Custom script to Executable with parameters

enter image description here

+2
source share

All Articles