Multiple Bamboo Schedules?
Asked by Seravy:

Up until Bamboo 3.0 we used to have two builds for a branch. A continuous integration build which would run per check-in and a release/nightly build which would run far longer tests that would take 3 hours.

<br />

The split of two separate builds have always been something less than Ideal because we use the build number in our versioning system and so we have two versions which are identical between all the builds.

<br />

Now we are on 3.2.2 the option of customized builds and plan variables has allowed us to move forward slightly. What we have now is a variable which indicates a release build or not which will run additional tests and tasks.

<br />

The problem is that we need two schedules, one on check-in and another at a specific time with a different variable set. We tried the JIRA integration to schedule releases however it just didn't sit right.

<br />

Is there a way to setup multiple schedules per build?

<br />

As a work around we have another plan run a task which invokes manual webpage calls to run builds (http://bamboo/ajax/runParametrisedManualBuild.action?planKey=\<key\>\&variable_ReleaseBuild=true), which is nothing short of a hack.  

<br />

<br />


Answers:
author: Marcin Gardias
body: This feature will be added in upcoming Bamboo 4.3

comments: author: Seravy
body: I downloaded and tested it in 4.3, seems good however the most critical thing which I can't seem to find is some way to figure out what triggered the build. I need to know if it was a nightly or a perforce checkin. I can't find anything on the triggers page, or when i look at the build log i can not see any extra information/variables being set.

Is there some variable which isn't listed here?

<https://confluence.atlassian.com/display/BAMBOO/Using+global,+plan+or+build-specific+variables>

Thanks


author: Dennis Ryan
body: I have been looking for a good way to do this since pre version one. We have the same builds you mention plus webdriver builds, and sql validation builds, so your situation is similar to mine, and I suspect a MAJORITY of bamboo users. I used to use multiple plans and symlink them together to avoid multiple checkouts, but that started failing in 3.3 and was a total kluge to begin with. Atlassian, Please I PLEAD, address this!


author: Przemek Bruski
body: I know it's not ideal, but currently, for customised builds schedules, using a separate plan to trigger your release build is the only option.

I'd use a REST call instead of webpage call though.

comments: author: Seravy
body: Thanks, I actually didn't think of rest to be honest with you. Haha.

A question regarding the 'seperate plan to trigger' comment though, Did you mean triggering through dependacy? If so would there be a way to change a variable?


author: Przemek Bruski
body: No, not from dependency, just via a task. You cannot set a variable when using dependency triggers.

You might be able to figure out whether the plan was triggered by dependency and alter your build process accordingly, but I think that a separate plan doing a REST call is a cleaner option.


author: Brantone
body: What would the set up look like for triggering a build from a Task? Simply making the REST call, or is there a plugin for making a specific call? Thx


author: Seravy
body: To my knowledge the task would need to call a custom EXE to make a rest call. There are no plugins that i know of which make tasks to make test calls. (Unles theres one on the market place already)


author: Gail Stewart
body: I reported BAM-13429 - requesting a variable that will tell me the trigger reason. Specifically so I can chose in my build script to perform certain tasks only on the build triggered by schedule. It's current priority is Minor. So far I don't see how all the new features in Bamboo address this yet.

comments: author: Seravy
body: Unless I am missing something Gail, I believe the orginal ticket that james raised [BAM-12427](https://jira.atlassian.com/browse/BAM-12427) will achieve what you want to do. Granted, it is still minor priorty but hopefully it should get some movement soon. You request a parameter 'bamboo.triggerReason' but that can be achieved using the orginal ticket variable 'bamboo.triggerDescription' with a user setting. Let me know if you see this differently and dont forget to vote and watch ticket [BAM-12427](https://jira.atlassian.com/browse/BAM-12427).


author: Brantone
body: The mentioned feature enhancement (<https://jira.atlassian.com/browse/BAM-1631>) has been open for almost 5 years. Yikes.


author: James Dumay
body: Hi Murray,

There is a feature enhancement open to support [multiple build schedules per plan](https://jira.atlassian.com/browse/BAM-1631). While this isn't sheduled for a release just yet, due to the high demand for this feature it is on our radar.

You mentioned wanting to set variables for different build schedules? Can you expand on that a little more please?

Thanks

James  
Product Manager

comments: author: Seravy
body: Hi James,

The comment about setting different variables for different build schedules was to allow modifications to the build plan through current means.

For example if there are two build schedules,

1. Build on checkin
2. Nightly Build

I would currently have a plan variable which says 'Run Build Full Integration Tests' which by default would be set to false. If i could set that variable to true on nighly builds but not on checkin builds it would automatically work in all my current build processes.

That being said, at minimum i would want a 'variable' (bamboo variable, environment variable, whatever) that i could use to pass to msbuild task (through the property field) or to use the environment variable in my msbuild script that would be able to detect what type of build schedule it is running (a variable named SCHEDULENAME set to whatever the schedule was named for example) and set the 'run intergraiton tests' property to true.

At the end of the day multiple build scheuldes would have no use to me (or anyone?) if there was no way to pass a flag to the tasks to indicate what schedule was running, I just thought that modifying plan variables was the most natural way to get it through.

Reading Bamboo 4 release notes i thought maybe [BAM-9189](https://jira.atlassian.com/browse/BAM-9189) [Allow running the same plan with different parameters (ie. plans templates)](https://jira.atlassian.com/browse/BAM-9189) could help but I can not seem to get it working on my test instance but it seems to just relate to running the same plan on different branchs.

For interest sake, my current way of handling this situation is a new plan called 'nightly builds' which runs a seperate EXE programmed to login as 'build' user and run the defined plans with the 'ReleaseBuild' parameter set to true (Defaults to false) through REST.

Thanks James for your interest in solving this problem.


author: Seravy
body: Hi James,

I tested the change in Bamboo 4.3 and noticed that there was no way to tell what triggered the build within the tasks, which was one of the 'must have' requirements.

What should I do to make a request to add this functionality to go through all of the processes?

Cheers


author: James Dumay
body: Hi Murray,

If we added some variables like ${bamboo.triggerType} (this is the type of the trigger, such as 'scheduled') and ${bamboo.triggerDescription} (The user configurable description or name of the trigger if not set), would that work?

Thanks

James


author: Seravy
body: Hi James,

Yes, both of them would be good.

I would want some way to separate the triggered build with scheduled (type variable), and then a way to differentiate the two scheduled builds (Nightly, weekend) which the description variable can be used for.

Cheers, Murray


author: James Dumay
body: I've [raised an issue](https://jira.atlassian.com/browse/BAM-12427) for this - please make sure you watch and vote for it :)


author: Seravy
body: Perfect. Thanks a lot. :)