开发者

How can I use build parameters from other projects in TeamCity?

开发者 https://www.devze.com 2023-03-19 05:47 出处:网络
I would like to use some build parameters from Project 1 in Project 2.I know that I can make Project 1 a dependency of Project 2 and then access its build parameters as described in Dependencies Prope

I would like to use some build parameters from Project 1 in Project 2. I know that I can make Project 1 a dependency of Project 2 and then access its build parameters as described in Dependencies Properties, but I do not want Project 1 to be bu开发者_如何学Pythonilt in response to a build of Project 2. For example, suppose I want Project 2 to be built nightly, while I only want Project 1 built monthly.

Is there any way Project 2 can access Project 1's build parameters under these conditions?


I would use a build configuration template that is shared between the two projects.

This means you can share properties between the projects, but also override certain ones in each individual project.

We use this for hourly builds that are not tagged and nightly ones that are tagged.

Then use a different build trigger to set one off nightly and the other monthly.

EDIT

I'll just expand slightly as a result of your comment.

In TeamCity we have 2 build configuration for the same project. One that builds on every check-in to give developers quick feedback on their contribution (build within 15 minutes). It does the following:

  • Builds the project in Debug
  • Runs all unit tests
  • Checks results of build into Subversion

The other configuration runs every night at midnight; it build everything and as a result takes a long time (around 45 minutes). It does the following:

  • Build the project in Debug and Release
  • Runs all unit tests
  • Builds Sandcastle documentaion
  • Checks results of build into Subversion
  • Grabs the Sandcastle output at an artefact so developers can easily download it.

As you pointed out this isn't as straightforward as one would like; however you can use the following to achieve it:

  • We use the Autoincrementer to share build numbers between the two configurations (they both increment the same build number when built).
  • We have a property on template that defines what artefacts to collect and is referenced from the artefacts field. The property is overridden on the second build config to define the sandcastle output to grab.
  • Sharing VCS Roots is mentioned on the documentation. Both our builds get the source from the same place, and tag the results to the same place. One VCS is most definitely all we need.

Bit of a long edit but I think it goes exactly on the lines of what you're trying to achieve. I appreciate I should have included this in the original answer.

HTH


Dependency is different from Build Triggering in TeamCity. If you make one project dependent on another ( artifact dependency ), it does not mean that the the latter will trigger the former.

Even when one project has been defined as dependent on another ( and also, even if not ) you have to specify explicitly the build trigger ( in this case a Finish build trigger ) for the dependent project to be triggered.

0

精彩评论

暂无评论...
验证码 换一张
取 消