Fetch multiple refs from same VCS root

I have this git project where I want to fetch a tag and a branch.

They have divergent history: there are extra commits in each of them that do not exist in the other.

I want to fetch both so I can merge them in a build step to run tests, but I don't need to commit anything back.

The teamcity agent itself does NOT have access to Gitlab (where project is cloned from) so I cannot fetch extra tags from the build step.

I have setup the vcs root as:
- default branch: refs/heads/my/branch
- branch specification:
+:refs/tags/*
+:refs/heads/*
 

All branches show up in the branch dropdown, so I think branch specification is working well. However, it does not affect fetch: teamcity only fetches the branch the build ran on, no other references.

How can I force teamcity to fetch other references? Again, I cannot do it with SSH agent build feature and a build step because the agent itself cannot fetch from gitlab….

 

0
2 comments
Hello,

Thank you for the detailed explanation — your understanding is correct.

In TeamCity, the branch specification only controls which refs are visible (for example in the branch dropdown and triggers). It does not influence what is actually fetched during checkout.
By design, the Git plugin fetches only the ref that the build is running on, along with the minimal set of objects required for that ref. This is why, even though tags and other branches are visible, they are not fetched during the build checkout.

Unfortunately, there is no supported way to force TeamCity to fetch additional branches and tags if they are not directly required by the build, and the branch specification cannot be used for this purpose.

> How can I force teamcity to fetch other references?

At the moment, there is no single-VCS-root configuration that can force TeamCity to fetch unrelated refs purely for use during a build. You will have to do it manually. I.e. disable the automatic checkout and perform the checkout with your own scripts.
0

That's unfortunate…

Thanks for the confirmation Tom.

0

Please sign in to leave a comment.