LinearB Deployment API

LinearB's delivery API enables paid customers to customize their deploy-time measurement to detect code deployments by API. This can also be customized to account for additional pre-deploy stages such as staging, pre-production, or QA. Additional stages added will be broken out in Metrics reports in LinearB.

Custom Stage Examples

  • qa - custom stage for QA stage
  • pre_prod - custom stage for Pre-Prod stage
  • release - built-in stage to identify actual deployment to production

Steps for Implementation

This API is available to paid LinearB customers.

Single Stage Deployments

If you would like to listen for just your code deploys, API tokens can be generated following these instructions: How to Generate a Release API Token. Once generated, use the example cURL calls below to add API calls to your CI/CD system.

Multiple Stage Deployments

Please contact your CSM or support@linearb.io in order to implement this feature. The process is listed below:

  • Notify LinearB of the release stages you utilize and the order in which these stages progress.
  • LinearB will configure your instance to listen for these stages.
  • LinearB will then send you an API token.
  • Use the example cURL calls below to add API calls to your CI/CD system.

Important Notes

  • The last stage of reporting should always be the built-in stage “release” in order to mark a relevant branch as deployed state and calculate the “time to deploy” metric correctly
  • A few notes about the API payload fields : 
    • stage_id  - stage key value from the list supplied by LinearB 
    • repo_url - should be as what known as “clone url” - including the .git suffix
    • event_time - event time in epoch time
    • head_sha  - prefer to be long commit sha format

Sample API Calls

Sample CURL for QA stage :

curl -X POST --header 'x-api-key: <API KEY> --header 'Content-Type: application/json' -d "{\"head_sha\":\"2f126296a5694ddd6eac7eb77ddfdb890d114d44\", \"repo_url\": \"https://github.com/linear-b/linpy.git\", \"stage_id\":\"qa\", \"event_time\": 1626764801}" https://public-api.linearb.io/api/v1/cycle-time-stages

Sample CURL for Release stage :

curl -X POST --header 'x-api-key: <API KEY> --header 'Content-Type: application/json' -d "{\"head_sha\":\"2f126296a5694ddd6eac7eb77ddfdb890d114d44\", \"repo_url\": \"https://github.com/linear-b/linpy.git\", \"stage_id\":\"release\", \"event_time\": 1626764801}" https://public-api.linearb.io/api/v1/cycle-time-stages

Read more about our API in Swagger: https://app.swaggerhub.com/apis-docs/Linear-B/linear-b_api/0.5#/Cycle%20Time%20Stages/reportCycleTimeStage 


How did we do?


Powered by HelpDocs (opens in a new tab)