How do you update the Bamboo build number from the build script? - bamboo

When I run my build script from TeamCity I can output ##teamcity[buildNumber '<new build number>'] and TeamCity will update the build number accordingly.
How can I do this in Bamboo?

You can't - at least not in a supported way.
Even ignoring the build script portion of your question, Bamboo simply doesn't support editing of build numbers like TeamCity does.
Here's the feature request
If you really want to edit the build number, you may be able to do it manually (at your own risk!) with a few SQL queries. This post from Atlassian's forums should help you get started.

Related

Is it possible to tell MSBuild in TeamCity to use multiple cores

Apparently the default number of cores MSBuild will use during compilation is 1.
In TeamCity I have tried adding /m:8 to the Command line parameters field in an MSBuild Runner type task to tell the MSBuild compiler to use up to 8 cores to compile the projects within the solution.
(I realise the amount it can do in parallel depends on the dependencies between the projects in the solution.)
However when I look in the build logs I don't see any mention of that parameter?
Is this the right way to do this? Does anyone know if TeamCity supports this?
Note: This is on TeamCity 8.1.5 (build 30240)
If you have access to the build agent, when the build is in progress, you could login and start task manager, to see if there are multiple msbuild.exe (s).
I don't think that the build logs will have any info about this. What kind of info are you looking for?

Can i get TeamCity to do what web essentials does? Less files and Bundles?

I am trying to get TeamCity to build less files and generate my bundles.
Is this possible in Team City?
Sure it is. Anything you can run from command line you can create a build step for. So, you need to find a script you can trigger from commandline (MSBuild for example, there's even a build runner for MSBuild). I would probably collect all build files as artifacts that I can later download directly from TeamCity. Something like this (all separate build steps):
Build everything
Generate css files and bundles (maybe part of step 1).
Generate msi file using something like WiX.
Collect artifacts within TeamCity.
This is a very nice setup, in my view. Probably you need to ask for more help on each step separately.
Good luck!

Integrate psake with MsBuild

I am using MSBuild for CI. I was looking recently to psake as an additional tool for creating scripts for daily builds as I need to do some updates to our builds which will be easier in psake. For the moment I’m not looking to replace our existing scripts as it requires a lot of work but keep the existing ones and add new using psake.
My question is - when I create a build in TFS how can I run the psake scripts after the solution is built? My understanding is that I need to add a new target after the build is executed and execute the psake/powershell. Is this the right way to do it?
Yes that is how you would do it. It is best to separate different parts of your build script so that if you want to change something, you can proceed with ease.
So, Ideally, you should have a task for compiling your solution, another for running the tests, another for packaging the source and so on ... I recently started using psake, and this is a good reference in case you want to look up something.
The right way to do this is to use TeamCity to run your psake build scripts. In your psake scripts you would create a psake Task that calls msbuild via exec { msbuild yourSolution.sln }.

Build fail success environment variable

I was hoping to know if there is a way to run a particular script, if and only if the build is successful. So if the build fails the script doesn't run.
Please and thank you.
You have several options.
Easiest: you have a free-style software project -- just create an addition build step at the end of your build. The step will not be executed if one of your previous step fails. I don't know how it behaves if your build is unstable.
Also easy: You have a Maven project: create a post build step (Steps to run after mvn build). You have the options to let these post build steps run on successful, successful + unstable, or always.
Create another job for your script and trigger it with the parametrized trigger plugin. This plugin gives you the most flexibility.
Hope that helps.

Pre-Pre-build Steps in Hudson

I'm in a bit of a pickle. I'm trying to run some environmental scripts before I run the build in a m2 project, but it seems no matter how hard I try - the 'pre' build script are never run early enough.
Before the 'pre-build' scripts are run, the project checks to see if the correct files are in the workspace - files that won't be there until the scripts I've written are executed.
To make them 'pre-build', I'm using the M2 Extra Steps plugin - but's it's not 'pre' enough.
Has anyone got any suggestions as to how I can carry out what I want to do?
Cheers.
Have you considered breaking it up into two projects, and setting the pre-build project to be upstream of the build project?
e.g.,
Foo Pre-build
Foo Build
After Foo Pre-build runs, cause "Foo Build" to run.
I have used this, admittedly in different scenarios than yours, quite successfully. This has the added benefit (if you need it) of allowing you to manually run a build without going through the pre-build steps, if you know they aren't necessary.
You should use the free form project type and not the maven project type.
If this is a problem (ie, there are projects that are expecting to be triggered by or triggering from), consider using a custom workspace location and having a free form project execute in this workspace before the maven project runs. The free form project can be used as the trigger for the maven project.
Does adding another build step as a shell script work?
My problem stemmed from the fact I wanted to set-up my workspace before I ran anything due to an issue with Dynamic Views (ClearCase) not being accessible from the workspace - I wanted to add a symlink to fix this.
However, Andrew Bayer has made a change to the plugin that I'm currently testing that should fix this...so the question is probably invalid in it's current form.
Will edit it once we come to a conclusion.