How to add current date into Artifact Path

Answered

Could someone please explain me how to parametrize Artifact Path setting in TeamCity with a current date

So I have it currently set as

\MyServer\FolderWithReports\MyReport20210707.csv

where 20210707 is obviously today date when report is generated.

The question is, how to replace it with a parametrized part which would change everyday, can I write something like:

\MyServer\FolderWithReports\MyReport%[DateTime:Now.ToString("yyyyMMdd")]%.csv

1 comment
Comment actions Permalink

Hello Andrey,

You may use parameter references in the artifact paths, but TeamCity will not evaluate an expression in such a reference. However, you could update a parameter during the build so that the correct file is saved as an artifact, using service messages (see this article for the details). 
Alternatively, artifact rules allow to publish anything under specific sub-folder as artifacts; you could save the report to a specific folder and publish everything that is in that folder.

0

Please sign in to leave a comment.