Artifact packaging with TeamCity

Posted on by Kirill Maximov

In the upcoming TeamCity 5.1 we’ve added an often requested feature – artifact packaging.

As you probably already know, in TeamCity you can easily configure artifact upload to the server. Later, from a build page, you can download all artifacts of the build. You can specify both directories and individual files as artifacts. The syntax for this is rather simple.

Build artifacts enable another really popular feature – custom reports. The essence of the feature is that if your build produces a report, viewable in a browser (any HTML/Text/Image/PDF), you can integrate this build report into the TeamCity interface. Report files are sent to TeamCity as artifacts, and you configure the report view in the TeamCity UI. One of the interesting things about custom reporting is that TeamCity can extract individual report files from ZIP-packaged archives. So if your report is a big directory with hundreds of files, you better zip them first before sending (to speedup the upload process).

Before TeamCity 5.1, you needed to zip the files in your build script. This required writing an Ant or NAnt task which prepared corresponding archive file. Unfortunately, not all build runners allow creating zip files.

In TeamCity 5.1, artifacts can be packed without modification of your build scripts. Just use archive suffix in your target path, and that’s it:

  testng-report =>
  **/src/**/*.java => sources/all-java-files.tgz

You can use suffixes zip, jar, war, tgz, tar.gz to specify type of the archive. For jar and war archives, the file format is just zip.

And as you would have expected, if you use tar/gz packaging on a UNIX system, TeamCity preserves file mode of the files, username, and group.

You can try artifact packaging in the just opened TeamCity 5.1 EAP builds.

Hope you’ll like these bits of syntax-sugar, and please share your feedback!



Subscribe for updates