Uploaded image for project: 'Bamboo Data Center'
  1. Bamboo Data Center
  2. BAM-25792

Bamboo is unable to send Failed build status to GIthub

XMLWordPrintable

      Issue Summary

      When we try to use a webhook as a notification to try to send failed build status from Bamboo to GITHUB for particular commit id, its failing with the status code 422

      {"message":"Validation Failed","errors":[{"resource":"Status","code":"custom","field":"state","message":"state is not included in the list"}],"documentation_url":"https://docs.github.com/rest/commits/statuses#create-a-commit-status"}
      
      

      This is reproducible on Data Center: (yes) / (no) yes

      Steps to Reproduce

      1. Intergrate Bamboo with GITHUB
      2. Configure Bamboo to trigger build after a commit in GITHUB - https://confluence.atlassian.com/bamkb/how-to-trigger-bamboo-builds-with-github-webhook-1097179080.html

      https://confluence.atlassian.com/bamkb/how-to-send-bamboo-build-status-to-github-via-webhook-1369639847.html

      3. Try to send the Bamboo build results to GITHUB

      For that we need to set up a webhook to transfer Bamboo build status to GITHUB commit via notifications in build plan.

      4. Use the below payload and header

      Payload :-

      {"state":"${'${bamboo.buildState}'?lower_case}","target_url":"${bamboo.buildResultsUrl}","description":"${bamboo.buildState}","context":"continuous-integration/bamboo"}
      

      Header :-

      Accept: application/vnd.github+json
      Authorization: Bearer <use your github token>
      
      

      Use the below notification url

      https://api.github.com/repos/ <GitHub username>/<repo name>/statuses/${bamboo.planRepository.revision}

      Expected Results

      The build status , target url , description and context arer passed to GITHUB for the commit ID

      Actual Results

      The webhook execution fails with status code 422

      {"message":"Validation Failed","errors":[{"resource":"Status","code":"custom","field":"state","message":"state is not included in the list"}],"documentation_url":"https://docs.github.com/rest/commits/statuses#create-a-commit-status"}
      

      However the problem is that GITHUB expects Bamboo to send the status of failed build as "failure" however Bamboo is sending the status as "FAILED" which GITHUB is not accepting

      state string Required
      The state of the status.
      
      Can be one of: error, failure, pending, success
      

      This is a follow up to https://jira.atlassian.com/browse/BAM-25700 where we fixed the success part. where GITHUB expects Bamboo to send the status in lower case i.e "success". Bamboo was sending this as uppercase "SUCCESS". Now the issue is with failed builds.

      Workaround

      No workaround as of now.

      Try to use this external third party plugin instead : https://github.com/HackAttack/bamboo-github-status

              851f15845f55 Mateusz Szmal
              f84a05b06223 Anik Sengupta
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: