Supported build-minute usage API + resilient bitbucket-build-statistics pipe

XMLWordPrintable

    • Type: Suggestion
    • Resolution: Unresolved
    • Component/s: Pipelines - Pipes
    • None

      Problem

      There's no supported way to programmatically export per-repo Pipelines build-minute usage at scale:

      1. No public usage API. The build-minute usage data shown in the UI (Pipelines → Usage details) is served by internal endpoints (pipelines/build-minute-usage, pipelines_config/allowance) that only accept a browser session cookie. API tokens are rejected with 403 "This API is not accessible by this authentication mechanism", so it can't be automated.
      2. The only supported alternative doesn't scale. Deriving usage by crawling GET /2.0/repositories/{repo}/pipelines/ per repo means one-request-per-repo across thousands of repos, and this endpoint returns HTTP 500 on deep pagination for repos with large pipeline histories — which are usually the biggest consumers, so totals come out undercounted.
      3. The official pipe inherits both problems. atlassian/bitbucket-build-statistics is built on that crawl and also aborts on the first error, so large workspaces never get a report.

      Proposed solution

      Expose the existing (already precomputed) build-minute usage data as a documented, public REST API authenticated with API tokens / OAuth:

      • Per-repo usage: GET /2.0/workspaces/{workspace}/pipelines-usage?start=&end=&pagelen= → {repository, total_build_minutes, change_pct 
      • Workspace rollup: GET /2.0/workspaces/{workspace}/pipelines-usage/summary?start=&end= → usage_minutes, quota_minutes, remaining_minutes, billing_plan_type

      Why it matters

      Any workspace beyond a few thousand repos hits this wall today, with no supported path to accurate usage data for cost/capacity reporting.

              Assignee:
              Unassigned
              Reporter:
              Karthick S
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated: