开发者

How to force TeamCity to build every commit into GIt?

开发者 https://www.devze.com 2023-03-18 12:50 出处:网络
Right now I\'m a happy user of TeamCity + Maven + Git. I have a one build like mvn deploy which should triggered by every commit into Git. All tests are run and everything is fine. =)

Right now I'm a happy user of TeamCity + Maven + Git. I have a one build like mvn deploy which should triggered by every commit into Git. All tests are run and everything is fine. =)

But this scheme has a problem, after I run mvn release:prepeare on my machine it creates two commits (with versions, say, 1.1 and 1.2-SNAPSHOT) in central Git repo one of which is tagged with 1.1. Because TeamCity checks for latest version every N seconds it actually builds only the latest one with version 1.2-SNAPSHOT. And this way build 1.1 actually never gets into Maven repo. Security policies does not allow me to run mvn deploy from my own machine and Maven repo deploy could only be done from TeamCity machine.

Thus I want to run both builds against both commits to repo. As far as I know this is impossible with only one build configured in TeamCity.

Now I'm using workaround: there is additional build that builds only "release" commits, which is triggered with trig开发者_运维百科gers with commit regex. Another possible workaround is using additional build that is built against specialized "release" branch.

But, I do not want to have workarounds and would like to force TeamCity to run build against every commit into Git. This will also help me with understanding of failed tests.


The problem with letting things build from one single build in TeamCity is that that particular build is tied to a branch (let's assume it's the trunk). However, when Maven does the release:prepare, it actually creates a tag. When it creates this tag, you don't have a build for it, as your existing project is tied to the original branch.

My suggestion would be to either bend your company policy, or create separate builds for each tag. We used to use TeamCity and we had your problem. I am the company's build manager and I do the releasing as well. I believe that as long as the original build passed correctly in the CI server, then it is perfectly fine for you to do mvn release:prepare release:perform and even mvn deploy.

0

精彩评论

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

关注公众号