Teamcity artifact paths with archive

3.2k views Asked by At

How do I copy files from a folder to the same folder in the target archive?

Below is what I came up with based on the documentation.

file_name|directory_name|wildcard [ => target_directory|target_archive ] 
 %env.PROJECT%/EnvironmentSpecificAppSettings/* =>EnvironmentSpecificAppSettings |  ..\..\..\..\..\..\..\Artifacts\CI\Website.%system.build.number%.%system.build.vcs.number.PROJECT_CI%.CI.zip
2

There are 2 answers

0
remo On

If you are talking about the artifact paths in General settings. Suppose you want the fodler 'Artifacts' in check out dir of the teamcity to be generated as artifacts in Artifacts.tgz then you may want to say:

       %system.teamcity.build.checkoutDir%/Artifacts => Artifacts.tgz
2
VoiceOfUnreason On

I know of three options.

As sharma noted, you can use artifact paths in General Settings, which will allow you to describe a mapping of files on the buildAgent to files in the archive. You can use absolute or relative paths here. I don't think I've ever tried using property expansions there.

You can also use service messages - by emitting a message with a special format to output, you can issue a number of different commands to TeamCity, including a command to publishArtifacts

You can also use a simple file copy in your build to the appropriate directory in the archive. TeamCity sets properties with the names of the folders that you will need - teamcity.buildConfName, teamcity.projectName, teamcity.agent.dotnet.build_id, etc.