How can I update Github with a bamboo plan build result

Dunia Alrabadi April 16, 2019

So if I have a test plan running on bamboo and I want to get the status of the build pushed to github every-time I commit and push to the remote branch. Is there a way to do that?

2 answers

0 votes
Alexey Chystoprudov
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 19, 2019
Dunia Alrabadi May 15, 2019

I am not sure how to get this plugin to work. Can you please give me more info on this. The readme is not much help

0 votes
Victor Debone
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 18, 2019

Hello @Dunia Alrabadi, welcome to the Atlassian Community :)

Currently solution for that is to have a final task on your build that will fetch the current status of build and use Github API to update your remote branch status.

We have an open suggestion for Webhook notification type BAM-14321 that could make your life easier, please follow it for status update as we have it under consideration for next releases.

Victor

Dunia Alrabadi April 30, 2019

Hi victor how do you fetch the status of the build?

Victor Debone
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 2, 2019

Hello @Dunia Alrabadi 

You may use the REST API with the endpoint /result. The URL you would use looks more or less like this (remember to substitute the <variables> :))

http://<Your Bamboo URL>/rest/api/latest/result/<projectKey>-<buildKey>-latest

Did that help you?

Dunia Alrabadi May 15, 2019

that helps a little more. My question is would this work even if the build is not finished? I would use this url in the final stage, which is within the build

Victor Debone
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 16, 2019

If you run the REST call from inside the build, it will be reported as "In progress". I have some alternatives to this option:

  • Trigger a second build when the first is completed, so you could get the final result;
  • Add a stage that is not final, so it would execute only on success. With a drawback that no failed build will be reported;
  • Add a stage that is not final, which could execute a variable change. Additionally, a last stage that would final, with conditional tasks that would decide which status to post to GitHub
Dunia Alrabadi May 17, 2019

I like that last idea. If I make a variable within the bamboo plan, do different tasks have access to them?
for example if I make a variable STATE = False 

if the build gets to the last not final task then i will set the STATE to TRUE. However if it doesn't then in the final task it will see that it is false and push to get hub. Can I do that? Meaning reading and writing  a variable within different tasks?

Like Victor Debone likes this
Victor Debone
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 21, 2019

Yes, you can read and write a variable within different tasks. You need to use plan variables.

Did it help?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events