Skip to content

Instantly share code, notes, and snippets.

@comandrei
Forked from pcreux/complete.sh
Last active August 29, 2015 14:00
Show Gist options
  • Save comandrei/1cfdccbf1ff080eb7676 to your computer and use it in GitHub Desktop.
Save comandrei/1cfdccbf1ff080eb7676 to your computer and use it in GitHub Desktop.
Bamboo Github Commit Status integration
Environment variables
GITHUB_TOKEN="token" OWNER="ownername" REPO="reponame"
Set pending.sh after Source Code Checkout
Set complete.sh after Parsing test results as a final task
# specs and cukes results are stored in JUnit format under test-reports
if (grep 'failures="[^0]"' test-reports/* || grep 'errors="[^0]"' test-reports/*); then
curl -H "Authorization: token $(GITHUB_TOKEN)" --request POST --data '{"state": "failure", "description": "Failed!", "target_url": "${bamboo.buildResultsUrl}"}' https://api.github.com/repos/$(OWNER)/$(REPO)/statuses/${bamboo.repository.revision.number} > /dev/null
else
curl -H "Authorization: token $(GITHUB_TOKEN)" --request POST --data '{"state": "success", "description": "Success!", "target_url": "${bamboo.buildResultsUrl}"}' https://api.github.com/repos/$(OWNER)/$(REPO)/statuses/${bamboo.repository.revision.number} > /dev/null
fi
curl -H "Authorization: token $(GITHUB_TOKEN)" --request POST --data '{"state": "pending", "description": "Build is running", "target_url": "${bamboo.buildResultsUrl}"}' https://api.github.com/repos/$(OWNER)/$(REPO)/statuses/${bamboo.repository.revision.number} > /dev/null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment