Teamcity: Drop-Down list for Configuration parameters - plugins

I am using Teamcity for automated deployment process in our application. It's a parametrized build where users will specify the environment, build location etc etc ...
Now, the thing is, can I get a drop down list to select these parameters from a predefined set?
Is there any way to do that ??

Not in current (6.5) TeamCity version, but maybe in future release:
TeamCity 7.0 EAP

Related

Using sln.DotSettings in TeamCity dotcover runner

I am using an NUnit 3 runner in a TeamCity 9.1.6 step. I've chosen "JetBrains dotCover" as the .NET Coverage tool, and now I'd like this step to use the xxx.sln.DotSettings file that we've put in source control and that we're sharing across devs in Visual Studio, rather than to duplicate settings to TeamCity Filters, Attribute Filters etc. Is this possible in TeamCity?
It is not possible from the box now. It is a great idea, could you create an issue here https://youtrack.jetbrains.com/
But there is a simple workaround:
you could parse dotSettins manually on the first step
publish configuration parameters using ##teamcity[setParameter name='ddd' value='fff'] TeamCity service message (see for details https://confluence.jetbrains.com/display/TCD9/Build+Script+Interaction+with+TeamCity)
use those configuration parameters in the appropriate fields for dotCover like %ddd%

TeamCity - AssemblyInfoPatcher not using updated variable

I'm changing the build number of the TeamCity (9.1.4) build with service messages (Build Script Interaction) like this in Powershell:
Write-Host "##teamcity[buildNumber '$version.$arg2']"
This is working absolutely fine.
The problem is that the AssemblyInfoPatcher doesn't want to use this updated build number.
So I tried to use a variable/parameter for it but this also doesn't work.
I defined the following variable "Major.Minor.Patch" as a "Configuration Parameter" or as an "Environment Variables". The AssemblyInfoPatcher is using these variables just fine and changes the file version of my files with the version defined in TeamCity in the build.
If I try to change the variable/parameter with a service message it doesn't work. The AssemblyInfoPatcher is still using the old value.
Example with environment variable
Write-Host "##teamcity[setParameter name='env.Major.Minor.Patch' value='$version']"
Example with configuration parameter
Write-Host "##teamcity[setParameter name='Major.Minor.Patch' value='$version']"
Am I doing something wrong or is it just not possible? The only thing I want is that my files have the same version number as my TeamCity build...
The AsssemblyInfoPatcher runs before any of the build steps (and then runs again to revert your AssemblyInfo files after all your build steps). Thus, if one of your build steps sets Major.Minor.Patch using a service message, it's really too late to the game.
Maybe you could string multiple build configs together. The first config (A) would set up the parameter like you're doing now, and then trigger the second config (B), which would use the AssemblyInfoPatcher. B would have a snapshot dependency on A (in addition to the finish-build trigger) and thus its AssemblyInfoPatcher would be able to refer to %dep.A.Major.Minor.Patch%. This parameter, of course, would already be available when B's AssemblyInfoPatcher runs.

TeamCity Custom Build Number - AssemblyInfo patcher

I have created a TeamCity build configuration which suits my needs, see build log below:
It's all working great except for 1 thing - Custom Build Number. My build number format is as follows:
Major.Minor.BuildCounter.TodaysDate, i.e. 2.0.59.20160224.
I achieved this with a PowerShell script.
Notice in the build log, Step 1 is to Set Build Number. Problem is that this happens after the Update assembly versions step. So this version number does not get applied to my assemblies.
But the correct version number is used everywhere else in the build process.
So my question is, HOW do I set the Custom Build Number before AssemblyInfo Patcher runs?
Resolved using Snapshot dependency feature of TeamCity.
Created a build configuration called Version. This has a powershell script build step which creates my desired build number.
Next, I make my actual build configuration dependent on the Version build configuration.
Then I get this build number in my actual build configuration, like so:
%dep.[Build Configuration ID].system.build.number%
Teamcity provides build feature "AssemblyInfo Patcher" which allows setting a build number to an assembly without having patch.
You may find it under :
Build Configuration Settings -> Build Features -> click on add new feature and select AssemblyInfo patcher.
You may assign same build number format "Major.Minor.BuildCounter.TodaysDate" AssemblyInfo Patcher. something like : %Major%.%Minor%.%build.counter%.%system.build.start.date%
By adding Major and Minor as teamcity configuration parameters.
You may use teamcity's predefined %build.counter% parameter.
And finally TodaysDate:
The Groovy Plugin for TeamCity provides build start date/time properties
system.build.start.date
system.build.start.time

Get Build Version in automated build deployment using TFS

I am deploying web application to azure using TFS CI automated build deployment.
In our config maintain build version like 2014.05.19.1 which is $(Date).$(rev) format.
All I want to update config each time build is deployed.For that I am passing value to 'BuildVersion' parameter in template to powershell script which actually performs publishing to azure.
I tried using $(Date:yyyyMMdd)$(Rev:.r) but it is considered string as it is.
I want to get current build version just like IBuildDetail.BuildNumber
within template.
My question is how to get the build version?
If you are using Invoke Process, instead of passing value for BuildVersion parameter you can directly use 'BuildDetail.BuildNumber' in parameters for process like
String.Format("-BuildNumber ""{0}""",BuildDetail.BuildNumber)
This would give the required build number.
If your PowerShell script is being executed from your TFS build, it should have access to the environment variables specific to the TFS context of the build. If that is the case, you actually don't need to pass the $(BuildVersion) parameter to the script, as it already is accessible to the PS script in the $env:TF_BUILD_BUILDNUMBER environment variable. Try testing something like $env:TF_BUILD_BUILDNUMBER | Out-File "D:\Dev\BuildNumber.txt" in your script. You should hopefully see the file containing your build number after running your build.
(I am assuming you are using a relatively new build process template...one that contains the "Post-Build script path" parameter, such as TfvcTemplate.12.xaml)
Hope this is helpful.
I would recommend that you use the right tool for the right job. The build system, is really only for building (compile & test). We have been using it for other things for years coz we did not have another integrated solution. However Microsoft recently bought InRelease and rebranded as Release Management for Visual Studio 2013. I have successfully integrated this with TFS 2012 as well.

How to parameterize Bamboo builds?

Please note, although my specific example here involves Java/Grails, it really applies to any type of task available in Bamboo.
I have a task that is a part of a Bamboo build where I run a Java/Grails app like so:
grails run-app -Dgrails.env=<ENV>
Where "<ENV>" can be one of several values (dev, prod, staging, etc.). It would be nice to "parameterize" the plan so that, sometimes, it runs like so:
grails run-app -Dgrails.env=dev
And other times, it runs like so:
grails run-app -Dgrails.env=staging
etc. Is this possible, if so, how? And does the REST API allow me to specify parameter info so I can kick off different-parameterized builds using cURL or wget?
This seems to be a work around but I believe it can help resolve your issue. Atlassian has a free plugin call Bamboo Inject Variables Plugin. Basically, with this plugin, you can create an "Inject Bamboo Variables from file" task to read a variable from a file.
So the idea here is to have your script set the variable to a specific file then kick off the build; the build itself will read that variable from the file and use it in the grails task.
UPDATE
After a search, I found that you can use REST API to change plan variables (NOT global). This would make your task simpler: just define a plan variable (in Plan Configuration -> tab Variables) then change it every time you need to. The information on how to change is available at Bamboo Knowledge Base