Is it possible to schedule a stage within a plan in Bamboo?

I would like to schedule the Deploy stage in my plan to run nightly instead of running automatically after the previous step or running manually. Is this possible?

2 answers

1 accepted

0 vote

You can't do it in Bamboo. What you can do is have an external script trigger continuation of that build using the following REST API. Have a look a REST tutorial.

I just wanted to show people exactly what I did to implement this within the Bamboo rest API.  I used groovy rest and then created a cron job to kick off the script.  I hope this helps someone in the future:

 

@Grab(group='org.codehaus.groovy.modules.http-builder', module='http-builder', version='0.7.1')

 

import groovyx.net.http.RESTClient

import groovy.xml.XmlUtil

import static groovyx.net.http.ContentType.JSON

 

def client = new RESTClient ('https://myhost:8000/bamboo/')

 

client.defaultRequestHeaders.'Authorization' = 'Basic <base-64 encoded username:password>'

//I needed to use this because I was having certificate issues 

client.ignoreSSLIssues()

 

def response = client.get (

    path : "rest/api/latest/result/<project key>-<plan key>",

    query : [

        'os_authType' : "basic", 'buildstate': "Successful", 'max-results' : "1"

    ],

)

def buildNumber = response.getData().results.result[0].@number

 

def kickoff = client.put (

    path : "rest/api/latest/queue/<project-key>-<plan-key>-" + buildNumber,

    body : [

        'os_authType' : "basic", 'stage' : "<stage-name>"

    ],

    requestContentType : JSON

)

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published May 18, 2017 in Bamboo

FAQ: How to Upgrade Bamboo Server

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...

1,811 views 0 6
Read article

Atlassian User Groups

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!

Find my local user group

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

Groups near you