Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TeamCity: On successful build push to Git Repo

Tags:

git

teamcity

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

Thanks, Henrik

UPDATE:

Ok thanks for your answer, I find it a bit complicated. I found out that I can simply push back tags on successful builds to my global repository from which TeamCity fetches data for the build. I can pull changes from it and see whether the last commits were successful.

I would be happy if TeamCity provided a simple option for this kind of workflow!

It would be awesome if every developer could just pull from a repo that is only updated when the build is successful, or am I wrong here?

like image 345
Henrik Avatar asked Nov 10 '12 22:11

Henrik


People also ask

How do you commit on TeamCity?

Edit → Verify → Commit Unlike the standard scenario (edit, commit, verify), TeamCity's Pre-tested Commit feature allows you to remotely verify your changes BEFORE committing them to the VCS. If your changes pass, TeamCity (in cooperation with your IDE) AUTOMATICALLY commits them to Version Control.

How do I push to a git repository?

In the command line, navigate to the root directory of your project. Initialize the local directory as a Git repository. To create a repository for your project on GitHub, use the gh repo create subcommand. When prompted, select Push an existing local repository to GitHub and enter the desired name for your repository.


1 Answers

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/.

like image 152
praseodym Avatar answered Sep 22 '22 09:09

praseodym