Git commit from build agent

We're switching to git from subversion.

In one of our build configs, we create a release version of our software using a number of build steps and custom scripts. We currently do this with subversion, and it all works.

1 Code is checked out
2 –SNAPSHOT is removed from the version string in .pom files. This is done so we generate a non-SNAPSHOT build, and prevent usage of SNAPSHOT artifacts in the repository.
3 Build executes (maven)
4 If successful, the non-SNAPSHOT pom files are committed to subversion.
5 The revision for that checkin is stored, for later tagging
6 The pom files are reverted to –SNAPSHOT versions.
7 The pom files are committed again to subversion, so developers can work again
8 The release version is tagged in subversion.

Yes I know there's a maven release plugin that does a lot of this work for us. It also does something we don't want, which is increment the minor version number in the pom files. That's why we do the above instead.

I can see that the checked out code in checkout directory on the build agent does indeed have the .git directory and all the related config files. I can also see that the checkout is from the TeamCity mirror. What happens if I commit and push code from the checkout dir? I imagine it will be pushing to the mirror. If I can push to the mirror, will the mirror update the "real" repository?

Thanks for any assistance.

Please sign in to leave a comment.