Combining artifacts in TeamCity

I watched quite a few of these discussions until I was successful.

Our build process (on TeamCity 6.5.5) creates two folders: A and B.

We are currently setting up folder B for deployment (artifact path. \ B => B-% build.number% .zip). However, it was decided that folder A should be included as an archive in zip of B. That is, after assembly, B-2.0.0.zip should look like this:

B-2.0.0.zip file 1 ... file n A.zip file a1 ... file an 

To accomplish this, I added an artifact path. \ A =>. \ B \ A.zip before the existing zip rule for B, so our artifact paths look like this:

 .\A => .\B\A.zip .\B => .\B-%build.number%.zip 

However, while A.zip is being created (I see it in folder B after the build), it is not added to the B.zip archive. I looked at the build result, and the artifacts were created in the expected order.

Honestly, I'm at a dead end. Any insight would be well and appreciated. I could potentially modify the construction of the script to execute this, but I would prefer, if at all possible.

Thanks in advance.

Edit (2/24/12): As for further research, it seemed that I had a problem creating the A.zip file as a temporary file and fell into place after creating all the artifacts.

So, I tried to reorder my artifact paths as follows:

 .\B => .\B-%build.number%.zip .\A => .\B-%build.number%.zip\A.zip 

I thought this would add A.zip to B.zip. Instead of a nested archive, a folder named A.zip is created. Am I just looking at the limitation of TeamCity's inability to embed archives?

+6
source share
3 answers

You're right, TeamCity does not support complex packaging schemes for artifacts. To do this, you need to add a build step to prepare files that will be published as artifacts.

+2
source

At least with version 9, you can now add multiple files to the same zip file by doing something like this in the "artifact paths" field:

 .\A => myArchive.zip .\B => myArchive.zip 

Not sure, however, if subfolders / subarchives can be created on the fly ...

+7
source

One option would be to use Teamcity Service messaging to create the first archive before the build is complete.

 ##teamcity[publishArtifacts '.\A => .\B\A.Zip'] 

Then the command city returns the assembly artifact at the stage of packaging the artifact in the assembly configuration:

Sort of:

 %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 
+2
source

Source: https://habr.com/ru/post/909204/


All Articles