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

The Bamboo /result API endpoint should return information from Plan branch builds

    • Icon: Suggestion Suggestion
    • Resolution: Unresolved
    • None
    • API
    • None
    • 0
    • 1
    • Our product teams collect and evaluate feedback from a number of different sources. To learn more about how we use customer feedback in the planning process, check out our new feature policy.

      Problem Definition

      When using the /result REST API endpoint, only results from the default branch are returned

      Suggested Solution

      Allow the /result REST API to also return Plan branches results by default or by using an expand property

      Workaround

      To retrieve all results from all Default Branches and Plan branches together, run the following script:

      #!/bin/bash
      ## Declare Curl options, credentials and URL
      CURLOPTS=( "-s" "-k" "-H" "Accept: application/json" "-u<username>:<password>" )
      BAMBOO_URL="https://bamboo.mydomain.net"
      
      ## You may have to adjust max-results
      REST_OPTS="?includeAllStates=true&max-results=25"
      
      # Create a list of default Plans
      PLANS=$(curl "${CURLOPTS[@]}" "${BAMBOO_URL}/rest/api/latest/plan${REST_OPTS}" \
                | jq -r '.plans.plan[].key')
      
      # Create a list of plan branches
      PLAN_BRANCHES=$(for p in ${PLANS} ; do
                        curl "${CURLOPTS[@]}" "${BAMBOO_URL}/rest/api/latest/plan/${p}/branch${REST_OPTS}" \
                          | jq --arg PLAN "${p}/" -r '$PLAN + .branches.branch[].shortName' ;
                      done)
      
      # Print both default and branch results
      curl "${CURLOPTS[@]}" "${BAMBOO_URL}/rest/api/latest/result${REST_OPTS}" | jq '.results.result[]'
      for PB in ${PLAN_BRANCHES} ; do
        curl "${CURLOPTS[@]}" "${BAMBOO_URL}/rest/api/latest/result/${PB%/*}/branch/${PB#*/}${REST_OPTS}" \
          | jq 'select(.results.size > 0) | .results.result[]';
      done
      

       

            [BAM-21991] The Bamboo /result API endpoint should return information from Plan branch builds

            I’m writing some auto-scaling logic for my Selenium grid in AWS. I want to regularly check the running jobs in Bamboo so that I can pre-scale my grid based on upcoming demand. Most of our jobs tend to be on feature branches, so they need to be included in the response. The provided workaround is too slow and inefficient for my purposes due to the hundreds if not thousands of REST API calls required.

            Nathan Clement added a comment - I’m writing some auto-scaling logic for my Selenium grid in AWS. I want to regularly check the running jobs in Bamboo so that I can pre-scale my grid based on upcoming demand. Most of our jobs tend to be on feature branches, so they need to be included in the response. The provided workaround is too slow and inefficient for my purposes due to the hundreds if not thousands of REST API calls required.

              Unassigned Unassigned
              73868399605e Eduardo Alvarenga
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated: