Reputation: 73
I've looked through a fair number of these discussions with no success so far.
Our build process (on TeamCity 6.5.5) produces two folders, A and B.
We are currently zipping folder B for deployment (artifact path .\B => B-%build.number%.zip). However, it's been decided that folder A should be included as an archive in the zip of B. That is, following the build, B-2.0.0.zip should look like:
B-2.0.0.zip
file 1
...
file n
A.zip
file a1
...
file an
To accomplish this, I've added the artifact path .\A => .\B\A.zip before the existing zip rule for B, so our artifact paths look like:
.\A => .\B\A.zip
.\B => .\B-%build.number%.zip
However, while A.zip is produced (I can see it in folder B following the build), it is not added to the archive B.zip. I looked at the build output, and the artifacts were created in the order expected.
Frankly, I'm stumped. Any insight would be well and truly appreciated. I could potentially modify the build script to accomplish this, but I'd rather not if at all possible.
Thanks in advance.
Edit (2/24/12): On further research, it seemed like I was running into an issue with A.zip being created as a temporary file and moved into place after all artifacts were created.
So, I tried reordering my artifact paths as follows:
.\B => .\B-%build.number%.zip
.\A => .\B-%build.number%.zip\A.zip
I thought this would insert A.zip into B.zip. Instead of a nested archive, it creates a folder named A.zip. Am I just looking at a limitation of TeamCity not being able to nest archives?
Upvotes: 6
Views: 5207
Reputation: 3353
At least with version 9, it is now possible to add multiple files to the same zip file by doing something like this in the "artifacts paths" field:
.\A => myArchive.zip
.\B => myArchive.zip
Not sure though, if subfolders / sub-archives can be created on the fly ...
Upvotes: 9
Reputation: 31
One option might be to use a Teamcity Service mesage to create the first archive before the build is finished.
##teamcity[publishArtifacts '.\A => .\B\A.Zip']
Then have team city give back the build artifact in the artifact packaging step in the build configuration:
Something like:
%env.TEAMCITY_DATA_PATH%\system\artifacts\%env.TEAMCITY_PROJECT_NAME%\%env.TEAMCITY_BUILDCONF_NAME%\%env.BUILD_NUMBER%\B\A.zip => .\B-%build.number%.zip
.\B => .\B-%build.number%.zip
Upvotes: 3
Reputation: 1832
You are right, TeamCity does not support complex packaging schemes for artifacts. The way to go is indeed to add a build step to prepare the files to be published as artifacts.
Upvotes: 2