Can TeamCity push successful builds to a git repository?
I cannot see a specific build step in TeamCity to do this.
I use the version 7.1.1 of TeamCity
T
i finally made it!
You have to add a build parameter in your teamcity project:
name= env.PATH
value= C:\Program Files (x86)\Git\cmd
and then you add a new commandline build step with custom script:
call git push "C:\Gruene Git Repos\TeamCityApp" master
the "call" word is important!
Thanks for the help! henrik
For a while TeamCity has supported VCS Labeling, this allows your VCS Root user (if it has write permissions) to tag the commit hash that was just built with the version or anything else TeamCity knows about (see entire list of parameter references in the TeamCity wiki).
As stated in another answer the Automatic Merge functionality available in TeamCity will automatically perform a merge into a requested branch from the specified list of branches (wildcard enabled) and it will monitor and build and only merge them if it succeeds.
The Automatic Merge functionality can be good, but if you don't have good test coverage it can also be dangerous as a developer could break something that doesn't have a test and that will cause issues in your code long down the road. One way to prevent this is to require +2 tests be created/run every time the project builds (configurable in TeamCity). These caveats are mentioned in the previously linked article announcing the Automatic Merge feature.
We encountered a similar issue not related directly to merging, but having a requirement to push some changes from the job beyond the "lightweight tags" (for Git at least) that TeamCity adds if you use VCS Labeling (terrible name).
What we ended up doing was:
You can have TeamCity execute a shell script that subsequently calls git push
(with appropriate arguments, e.g. git push <repository>
to push to a different repository). Do make sure that git
doesn't need interactive authentication for the push operation.
A related example (deploy to Heroku using a git push
) can be found here: http://blog.carbonfive.com/2010/08/06/deploying-to-heroku-from-teamcity/.
My solution maybe is stupid, but simple. The steps is as follows:
Cloning your heroku from heroku git repository it will create your heroku app folder.
heroku git:clone -a {app-name}
Copy the files you need to update to heroku
xcopy client "{app-name}/client" /e/i/h/y
xcopy server "{app-name}/server" /e/i/h/y
xcopy imports "{app-name}/imports" /e/i/h/y
git add.
cd {app-name} && git add .
git commit
cd {app-name} && git commit --message 'ok'
push to heroku
cd {app-name} && git push heroku master
If you upgrade to 8 or newer you can just make one or more "Automatic Merge" build features. This will push to remote repo. I didn't find it at first either because of the confusing naming but it makes sense that they have to support many different VCS with different naming.