TeamCity: dont see Branch Tab in some projects - teamcity

What the difference in configs ?
Project with Branches Tab:
Project without Branches Tab:

If you only have one branch specified in the VCS config, you won't see a Branches tab.

TeamCity doesn't show branches in a project in case it knows nothing about them, i.e. there are no builds/changes in the project since project have been created. So if there is an old project with builds, newly created one has no knowledge regarding those builds. Try running a build in a branch, it should help.

Related

How to change the branch being built in TeamCity

How do I change the branch being built in TeamCity. It seems like the master is the only branch I can use:
Disclaimer: I'm fairly new to TeamCity.
I click on project which will show me my repository.
Clicking on both the drop down arrows shows me the branches of my repository
Click on the branch you want to build. Then you can run the build

Start build on old branch without new commit

Context
I have a project absed on a vcs root with the wildcard branch filter (+:*), meaning that it will trigger a build on every possible modification pushed to git.
Because we're on a migration process, our current projects have a lot of branches, and we want to start the build process on some of them.
Issue
Because the Run button of the build starts a build with default branch (AKA master), we can't run a build on a given branch, the need being to have a select box with existing branches that you can select for the build.
Already tried / Invalid solutions
A solution would be to push a dummy commit on each branch to trigger TC and make it see the branch, this way we could select the branch in the run options, but that's not a solution to us because pushing a dummy commit just for that feels wrong.
I can also use the solution provided in Select Git branch for TeamCity Build, but the issue is that we have a lot of branches with quite heavy names, and this solution allows typo, which is not what we want.
Make sure you have correctly configured branch specification in VCS Root settings. In my case:
Go to build configuration, select branch you want to build from and press run:
Working with feature branches from TC docs should be helpful as well.
Hope that helps.
PS: Based on TC 2017.2.1 (build 50732)

Sonar refuses to analize multimodule project

I have upgraded from Sonar 5.3 to 6.2 and a project X is giving me some weird errors at the sonar stage of the jenkins job (altough build finishes as STABLE).
The project is a standard multimodule maven java project.
Entering the project dashboard a single message appears on screen:
"No analysis has been performed since creation. The only available
section is the configuration."
But in the upper-right corner the red "FAILED" tag shows up. That leads to the Background tasks of the project and there is the failed task with this error log:
The project "com.foo:bar-submodule-1" is already defined in SonarQube
but not as a module of project "com.foo:bar". If you really want to
stop directly analysing project "com.foo:bar-submodule-1", please
first delete it from SonarQube and then relaunch the analysis of
project "com.foo:bar"
I do not want to delete the project and lose the historical data.
So the question is: How can i add a project Y (that is a submodule of project X but Sonar does not recognize it) as a submodule of project X?
EDIT 1
The parent project is the only one that has been analyzed through jenkins jobs.
Your problem is not that Sonar can't figure out your submodules, but the root issue is that there is another project/module with the same name conflicting with the project you are analyzing now. It happens, for example, when you extract a submodule as a standalone library and moves it as a root project and try to analyse the new project. Since it is a new project, but sometime in the past you had another project/module with the exact same name, it won't be able to finish the process. I have found three ways to fix this:
Delete the old project, if it is possible
This is a option that I use when I have analysed mistakenly new projects (with wrong parameters for example) or when I am migrating servers and still have some wrong configuration in place. You can do this in the project's Configuration/Administration menu, 'Delete project'.
Rename the old projects keys
This is my default option, since usually what I want is just keep the old analyses data for old submodules that we are moving to other projects or promoting to root modules. You can do this in the project's Configuration/Administration menu, 'Update key' option.
Updating your current project's keys
This option I use when the submodules conflict with other valid submodules (It can happen when you have different teams creating small libraries that happen to have the same keys). You can do this in two steps. First you need to update your project's keys following the option 2. The next step is to go to your project and update the modules and submodules names using the key sonar.moduleKey. The default value for this is : similar to sonar.projectKey, as especified here. Following these steps you won't lose all your records and old analyses.
I hope it helps.

creating release branch build in team city

I am working with Team City for .net and use it for continuous integration - works well. I have it running off my main branch.
I now have a release branch - how I can I configure to set up a release branch in team city. What is the best way to do this?
What I've done before is to copy the build configuration of my trunk build and then just create a new VCS root pointing at the other branch and use that in the new configuration.
Your can track several branches using Branch Specification field of VCS root. Specify wildcard for you branches like
+:refs/heads/release_* (for release branches) or
+:refs/heads/* (for all branches)
More details in docs.
Some notes:
Run build button runs it for default branch. Click ellipsis -> Changes tab to select specific branch.
Now you cannot use artifact dependencies for specific branch. Such dependencies will always use the default branch.
Regarding issues with artifact dependencies, it's not easy to create deployment configurations from branch specific artifacts. In this case I'd go using separate configurations for each branch. Otherwise you should rely on API and/or some artifact path name parsing logic.
If you don't need per branch deployments, it's completely ok to just use branch specs approach.

TeamCity don't trigger automatic build

I'm dumb with continuous integration and noticed a behavior that does not seem right..
I'm using Mercurial with TeamCity. When I push changes the TeamCity detect the changes but don't run the build automatically. This is correct behavior? He should not detect the changes and run the build automatically?
Triggers are not added to build configurations by default in TeamCity. You'll need to go to the settings for the configuration and click on "Build Triggers" then "Add Trigger". The type of trigger I believe you are looking for is a "VCS Trigger".
The documentation for this feature can be found here.
I believe my issues was misunderstanding what was needed in Branch Filters. I thought I was supposed to enter the GIT refs I wanted to have builds triggered from
This wasn't working for me
+:refs/heads/*
-:refs/heads/releases/6.7.3
-:refs/heads/releases/6.8.30
-:refs/heads/releases/6.8.32
-:refs/heads/releases/6.8.34
And this is what finally figured out (I think) is that it is asking for the branch names inside TeamCity itself (the help text says "Newline-delimited set of rules in the form of +|-:logical branch name")
This worked for me, to trigger builds from the branch (GIT ref refs/heads/master for me, look back in your VCS Root setup) and all other branches except those labeled "releases/6.7.3", "releases/6.8.30", "releases/6.8.32" and "releases/6.8.34"
+:*
-:releases/6.7.3
-:releases/6.8.30
-:releases/6.8.32
-:releases/6.8.34

Resources