Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TeamCity Extracting Artifact Dependencies

Tags:

teamcity

I'm trying to create a build step in Teamcity that has an Artifact Dependency on another build step.

The previous build step's artifacts are available as a .zip file.

The build step is able to retrieve the artifacts and they are downloaded to:

C:\BuildAgent\work\27f84e3eca3a33d5\artifactdir\artifacts.zip 

Clearly a .zip file isn't much use to me, I need these to be decompressed so that the build step can access the build file.

How do I get TeamCity to decompress the artifacts?

like image 694
reach4thelasers Avatar asked Mar 20 '11 16:03

reach4thelasers


1 Answers

You can use the Artifact Rules of Artifact Dependencies to specify the elements of an artifact you would like to use as part of your dependency, including extracting from an archive. The Artifact Rule syntax is:

[+:|-:]SourcePath[!ArchivePath][=>DestinationPath]

The Archive Path is the element of particular interest for you here. Using your example, your artifact rule would look something like:

artifacts.zip!** => artifactdir 

This will extract all the contents of the artifacts.zip artifact, and place them in the artifactdir directory at the root of your checkout directory

ArchivePath is used to extract downloaded compressed artifacts. Zip, 7-zip, jar, tar and tar.gz are supported. ArchivePath follows general rules for SourcePath: ant-like wildcards are allowed, the files matched inside the archive will be placed in the directory corresponding to the first wildcard match (relative to destination path) For example: release.zip!*.dll command will extract all .dll files residing in the root of the release.zip artifact.

You can find the full TeamCity Artifact Dependency documentation here

like image 159
Drew Grubb Avatar answered Oct 07 '22 18:10

Drew Grubb