I'm trying to setup a new plan that makes use of several stages. I would like to setup the following stages:
Check Out - Checks out source code and cleans previous builds
Compile - Compiles source code
Unit Test - Runs unit tests on compiled code from previous stage
Clean Up - Cleans up after build
The problem I experience is that each stage checks out the source code before running its jobs. Is it possible to have the source code just checked out once (Check Out-stage), compiled once (Compile-stage) and tested once (Unit Test-stage) ?
I've looked through the documentation, but can't seem to find a clear answer to this. I've found a Check Out-task that you should be able to add to jobs but can't seem to find it in the version we run, which is 3.2 build 2600.
Is it simply a question of upgrading?
It is possible, you just need to do all this in single Job using multple Tasks. Tasks are what you are really looking for: Tasks of a Job are executed in sequence and share common working directory.
Jobs & Stages in Bamboo are higher level concept: for example you can use multiple Jobs to parallelize your build process, but doing things in parallel means you need initialize resources (i.e. source code) for each Job separately. Stages let you organize Jobs into logical sequence, but again, at higher level than 'checkout-compile-test' cycle. Example is: in first stage you run compilation & tests then if this succeeds you build the installation bundle or deploy product to a server. (you can use artifacts, e.g. binaries, produced in earlier stages thanks to feature called Artifact Sharing)
What you need is (probably) single stage, containing single Job which contains multiple Tasks. It's hard to tell which Tasks exactly you'll need as I don't know your build environment, and depending on what build system you use you will need different Tasks (Maven, Ant, Script, Test result parser,...)
Note on the Checkout Task: this is available since 3.3. In Bamboo 3.2 and lower checkout is automatically done at the beginning of each Job. You can switch it off by changing source control system in Job to 'None'
As for upgrading: there are new, great features in each release, but in your case it is a choice not necessity :-)
Thanks for the fast answer. I'll use one stage with four jobs (one for each module) containing multiple tasks then. This way I will get Bamboo to build the modules in parallell right?
Just to be sure, if I sometime in the future wants to deploy my built modules to a server I can use a stage to do this using shared artifacts?
>This way I will get Bamboo to build the modules in parallell right?
Yes, as long as there are build agents available, Jobs will be run in parallel.
And yes, Shared Artifacts + deployment stage is exactly what we designed Stages for :-). You might also want to look at Manual Stages for more control (Manual Stage is a stage that is only run when you manually trigger it)
I think 1 stage with 4 jobs is still too many. Jobs are bigger than the pieces you're trying to do. What are you using to drive your build? Ant? Make? Maven? The sequence of steps you're talking about "compile + unit tests" would traditionally be a single target or goal in your build tool.
$ mvn clean unit-test
$ ant clean unit-test
That's a single stage and a single Job. Multiple jobs are more for things like: Run all my unit tests, Run all my functional tests using Firefox browser, run all my functional tests using IE browser, generate Sonar or Checkstyle code analysis. All of those would be in one Stage but be multiple Jobs so they could execute in *parallel*. Once all those went green you could then pass artifacts to another stage that would do some other downstream thing like installing the artifact on a remote target environment.
We use Ant for compiling and testing and a number of bash scripts for packaging and deployment. I want to be able to run things in parallel to speed things up. Right now we are only intrested in compiling and running unit tests. The setup you are talking about Rene is not far from what we already got, 4 jobs (one for each module) with only one Ant task that run a couple of targets. Splitting the Ant task into diffrent tasks looks more clear to me. You can easily get an idea of what is suppose to happen.
Hi, I've managed to find a way to do what you wanted to (as I wanted to do the same thing), you can see my workaround in the answer here:
Badges are a great way to show off community activity, whether you’re a newbie or a Champion.Learn more
Bamboo 5.9 will no longer be supported after June 12, 2017. What does this mean? As part of our End of Life policy, Atlassian supports major versions for two years after the first major iteratio...
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG
You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs