Method to override git tags
Hi there
I use and love the VCS labeling build feature in TeamCity. It works great for our regular builds.
I'd like to set this up if possible: when a new build is deployed into production, I'd like to update a tag (or delete and recreate a tag) to indicate which revision is the currently deployed revision.
I set up the labeling feature on the build template which runs deployments, but after pushing the tag once, Teamcity fails to re-tag on subsequent runs. I believe this is because the tag name already exists in git.
Git's tag command can take a --force flag, which allows an existing tag to be overwritten. But the VCS labeling feature does not set this flag or expose it as a parameter.
Can anybody think of a way I can achieve this?
Thanks
Please sign in to leave a comment.
Hi,
the --force flag is not supported at the moment, please watch/vote for https://youtrack.jetbrains.com/issue/TW-22215. As a workaround you can create a tag as a last step in the build and push it with the --force option manually.
Hi Dmitry
Thanks - I've voted and left a comment there.
I went down the path of scripting this myself but then I realised that if I run git commands via the command line runner, then git doesn't automatically have the authentication context of the agent which ran the checkout.
Do you have any pointers or blogs regarding authentication to git from the command line runner?
Thank you!
I don't think there are any blog posts about git authentication, sorry. Do you use http protocol? If so, you can add a password parameter to a build configuration and reference it in a script. If you use ssh, then the SSH Agent build feature can help (https://confluence.jetbrains.com/display/TCD18/SSH+Agent).