I want to provide a git tag to the TeamCity server to build it. I pass the tag (i.e. release_1.1
) as a parameter to the job. So inside the job the tag is available as %tag%
, but under the Version Control Settings
I don't see any way to use this parameter so the server can checkout this tag. Is there any way this parameter can be used in the settings to checkout the tag?
Create Git Tag. In order to create a new tag, you have to use the “git tag” command and specify the tag name that you want to create. As an example, let's say that you want to create a new tag on the latest commit of your master branch. To achieve that, execute the “git tag” command and specify the tagname.
Then you can perform git merge tag_name to merge the tag onto a branch. I had to do git remote add upstream [email protected]/org/repo followed by git fetch --tags upstream to make it work.
For all your VCS roots for this build configuration click Edit and then:
Then you'll be able to choose a tag when you press the '...' button beside run.
I've managed to get the following working:
In the Build Configuration, under "Build Parameters":
Define a Configuration Parameter:
TagToBuild
Configuration parameter
Tag to build
This should be the full path to the tag, i.e. refs/tags/0.5.5
Prompt
Text
Note that the "value" field was intentionally left blank.
Then, in the VCS Root:
%TagToBuild%
When I run the build, I'm then prompted to supply a branch/tag name:
Entering a value such as refs/tags/0.5.0
results in a nice build, with the branch name listed in the results:
If you try to help the user in any way beyond the description, this seems to fail. So you can't do any of the following:
refs/tags/
and have the user add the tag name.refs/tags/%TagToBuild%
.In both cases on our slightly old (7.1) instance of Team City I got the error:
Failed to collect changes, error: Argument 2 for @NotNull parameter of jetbrains/buildServer/buildTriggers/vcs/VcsRootChangesLoader.loadChanges must not be null
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With