0

I know, for instance, that I can make the build not trigger when I put certain text in a commit message. What I'd like to do is make it so I could change the value of a parameter based on the commit message that triggers the build.

Specifically I have a build parameter that a script looks at to determine whether or not to refresh a local db for integration tests. This is used for when we make alterations to the database or an integration test is dirty and doesn't clean up after itself, we can force the build to refresh the DB to a stable state.

I'd like to be able to add some specific text to the commit message that could then alter that parameter (or less ideally, be read by the script that is currently reading the build parameter) to trigger the build to refresh the DB. I'm using Teamcity 8.

Jeff Martin
  • 10,812
  • 7
  • 48
  • 74

1 Answers1

0

Adding a conditional behaviour of this kind is not a good idea. When your build starts doing different operations, you can loose the actual status (red/green), e.g.

  • A build tries to clean up the DB, fails to do so.
  • Next build doesn't try to do this and is green
  • the DB clean up operation result is lost, as the build configuration status is Green now

Instead, I would recommend settings up separate build configuration that does the DB reset.

In "DB reset" configuration, add a snapshot dependency on "Integration test", with "run build on the same agent" option enabled and a VCS trigger that listens to your specific commit message.

This way, you will have DB reset after each integration build when commit message contains "magic spell". And you will always see if the reset was successfull (or not)

Nikita Skvortsov
  • 4,768
  • 24
  • 37
  • This is probably ultimately what i will get to but I think i need some intermediate steps as we move more testing to better UNIT testing and away from Databased testing. – Jeff Martin Aug 20 '13 at 16:38
  • @Nikita Skvortsov Is there a way to store the commit message in a variable so that I can use it some other purpose – Nevin Raj Victor May 21 '15 at 05:46