Copy artifact dependency to agent

Let's say I have two projects (ProjectA and ProjectB) and two agents (AgentA and AgentB). ProjectA is only built by AgentA, and ProjectB is only built by AgentB. AgentA and AgentB are different machines (and may even be running on different platforms).

ProjectA creates several artifacts and has no artifact dependecies on any projects.

I want ProjectB to have an artifact dependency on a specific build of ProjectA (say, build #42) and a specific artifact (say, foo.zip).

Since AgentA and AgentB are on different machines, AgentB does not have the artifacts that AgentA has created from the ProjectA build. But the TeamCity server will have those artifacts.

When I click the "Run" button on ProjectB, I would like the server to copy the foo.zip artifact from build #42 of ProjectA over to AgentB (and then AgentB will do something with foo.zip).

How do I set this up with TeamCity 7.1.5?

6 comments
Comment actions Permalink

Thomas,

What you describe is exactly "Artifact dependency" feature.

In your ProjectB's dependencies settings, add new artifact dependency, select "ProjectA" as a source configuration, "Specific build number" as source build, "foo.zip" and destination as you wish. After that, TeamCity will provide required artifact before build starts.

More details ca be found here: http://confluence.jetbrains.com/display/TCD7/Artifact+Dependencies

0
Comment actions Permalink

Hi Nikita,

I've tried reading through the documentation but it's not clear.

Can you give me a detailed answer?

i.e.:

1. What does the "artifact rule" I need to use look like exactly?

2. Where will the artifact be copied on the local disk of the agent?

0
Comment actions Permalink

The artifact rule in general looks like this:

foo.zip => destination/directory/path

resulting location of downloaded foo.zip is "<SourcesCheckouDir>/destination/directory/path", so the destination in the example above is relative to checkout directory.

0
Comment actions Permalink

Thanks, that's what I was looking for.

Can the TeamCity agent also automatically expand foo.zip into /destination/directory/path/ ? I don't have control over the Windows build agents we use, and none of them have a Zip utility installed.

0
Comment actions Permalink

Yes, TeamCity can extract "zip" and "tar.gz" content for you. Extracted files can also be filtered using patterns. E.g.:

foo.zip!** => destination/path           --- will extract all files and directories to "destination/path"
foo.zip!**/*.txt => destination/path    --- will extract all txt files preserving directories structure to "destination/path"

0

Please sign in to leave a comment.