Single repo for building multiple NuGet packages

Answered

So I'm trying to automate the build/feed deployment process for a large number of NuGet (chocolatey, in particlar) packges.
The scripts and NuSpecs for each package are kept in a Git repo, that is organized like this:

-Readme.MD
-Packages/
-Packages/build.ps1
-Packages/Packageone/(nuspec and package contents here)
-Packages/Packagetwo/(nuspec and package contents here)
-Packages/Packagethree/(nuspec and package contents here)

and so on.

Creating a git repository for each package would be extremely cumbersome, as would creating a build configuration for each package (especially given the limited number available and how they would all be so similar).

How it is currently working is that I have a VCS trigger:

-:.
+:root=GitRepo:packages/**

This trigger means that whenever a package is added or modified, the build starts.

Currently the build consists of two steps. Step one is to run the build script for each package, and step two is to publish the .nupkgs to a NuGet feed.

Basically I was wondering if I could get some guidance on modifying step one to only execute the build script for any packages that are new or updated, to reduce time spent on redundant builds.

1 comment

Hello Brendan,

We generally recommend to eliminate "varying" behavior of the builds as this way you no longer "compare" builds in the build configuration: they start to form multiple unrelated sequences. The recommended approach is to use separate build configuration for each package (and check out only the necessary files for it using checkout rules, separate VCS roots are not needed). We understand that this can easily force you out of Professional edition limits, but this recommendation is based on the best approach vision.

If you do want to have all this in a single task, you will need to devise a logic in your build script to understand the changed files (e.g. use "teamcity.build.changedFiles.file" property, or REST API to get changes of the build) and run appropriate commands.

0

Please sign in to leave a comment.