You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
Hello,
I would like to call the github API at the end of the build in order to tell him if the build was successfull or not.
I've created a final task for this but I can't find a bamboo variable who contains the build state.
Could you help me?
Thanks :)
Hélène
Okay so I found the perfect variable (undocumented) : `bamboo_jobFailed` :)
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.
Can someone please share the api, it would be helpful for me.
Iam searching it for past week couldn't able to get the proper one.
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Github Commit Status API:
https://docs.github.com/en/rest/commits/statuses#create-a-commit-status
Script Task in Bamboo:
REPO="repo-owner/my-repo-name"
if [[ "$bamboo_jobFailed" == "false" ]]
then
STATE=success
else
STATE=failure
fi
DATA="{\"state\":\"$STATE\",\"target_url\":\"$bamboo_buildResultsUrl\",\"description\":\"Bamboo build succeeded!\",\"context\":\"default\"}"
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $bamboo_github_token"\
-H "X-GitHub-Api-Version: 2022-11-28" \
"https://api.github.com/repos/$REPO/statuses/$bamboo_repository_revision_number" \
-d "$DATA"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
looks like there was a syntax update to reference the variable, example script
${bamboo_jobFailed} instead of $bamboo_jobFailed
#!/usr/bin/env bash
## bamboo does not catch some script failures unless this flag is set
set -e
TASK="CHECK BUILD STATUS"
echo ================== START $TASK ==================
## bamboo_jobFailed is a boolean
BUILD_STATUS=${bamboo_jobFailed}
if [[ "$BUILD_STATUS" == "true" ]]
then
echo "the build has failed"
else
echo "the build is passing"
fi
echo =================== END $TASK ===================
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I would suggest to install this plugin: https://github.com/HackAttack/bamboo-github-status
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.