I want to perform some cleaning of an external resource, so I've created a stage, which is a final stage of a plan.
According to Bamboo it should run no matter what.
Is there a way to know in that final stage, if all stages until that stage succeeded or at least one failed?
Hello Yogev,
Welcome to Atlassian community
You can look at the Buildresult of that run and see what stages passed and what failed, in this particular run, we can see Stage 2 Job 2 failed and Final stage was run successfully.
Regards,
Shashank Kumar
**please don't forget to Accept the answer if your query was answered**
Thanks for your response.
Maybe I didn't clarify myself: I meant that I want to check programmatically in a script task of the final stage, if the build failed or not.
I want to be able to perform some cleanups in case the build failed, automatically in a task within the final stage.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Yogev,
You can use the REST API to get the details, refer api-api-latest-result-projectkey-buildkey-get for more details.
You'll need to use the expand parameter for stages, see example below
The result would look something like below when you expand the stages, it would print the status of the stage and you can see if your previous stage was successful or failed.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you
Hmm, for some reason I get
curl: (56) Recv failure: Connection reset by peer
My request is
curl -X GET -H 'Authorization: Bearer Mddd' -H 'Accept: application/json' --url 'http://bamboo:8085/rest/api/latest/result/PPP-AO-123?expand=stages'
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Seems to be a network/Proxy/Firewall Issue, Have a read at at https://github.com/curl/curl/issues/1016
Regards,
Shashank Kumar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks. I think it doesn't help though.
Because this one (without a build number) does work.
curl -X GET -H 'Authorization: Bearer Mddd' -H 'Accept: application/json' --url 'http://bamboo:8085/rest/api/latest/result/PPP-AO?expand=stages'
{
"results": {
"size": 25,
"start-index": 0,
"max-result": 25
},
"expand": "results",
"link": {
"href": "http://bamboo:8085/rest/api/latest/result/PPP-AO",
"rel": "self"
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Yogev,
It won't work without the build number, because you are trying to fetch the results data which is available per build.
You can use bamboo.buildNumber variable to pass to the API, read Bamboo variables for more details
Regards,
Shashank Kumar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
In my last response when I added the example
curl -X GET -H 'Authorization: Bearer Mddd' -H 'Accept: application/json' --url 'http://bamboo:8085/rest/api/latest/result/PPP-AO?expand=stages'
I meant to show that other requests does work.
Anyway... I restarted my computer and it now works, I have no idea how.
Thank you!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.