If you want to send build data from a CI platform that BuildBasis doesn’t have first class support for, you can use a simple HTTP request to send data for analysis.
Configuring any project to report data to BuildBasis requires an API key. You can view your organization’s API key in the BuildBasis Dashboard API Page.
1.) Add the following script to your pipeline:
curl -X POST -H 'Content-type: application/json' \
-H 'X-Buildbasis-Platform: custom' \
-H 'X-Api-Key: BUILDBASIS_API_KEY' \
--data "{ \
\"job_number\": \"JOB_NUMBER\", \
\"build_url\": \"BUILD_URL\", \
\"project_name\": \"PROJECT_REPONAME\", \
\"commit_hash\": \"SHA1_COMMIT_HASH\", \
\"repository_url\": \"REPOSITORY_URL\", \
\"branch\": \"BRANCH\" \
\"tag\": \"TAG_NAME\" \
\"status\": \"BUILDBASIS_STATUS\", \
\"start_time\": \"2019-12-26T22:27:50Z\", \
\"end_time\": \"2019-12-26T22:29:14Z\", \
}" https://api.buildbasis.com/api/v1/webhook
All fields are required unless explicitly noted otherwise.
Field Descriptions:
* **job_number**: A unique auto-incrementing identifier for a specific pipeline run
* **build_url**: A unique url to link to a specific build pipeline for a specific project
* **project_name**: The name of the project you are running within the pipeline
* **commit_hash**: The commit hash of the code that was ran during the specific pipeline
* **repository_url**: The project repository url (ex: `https://your_vcs_provider.com/your-account/your-project`)
* **status**: The status of the pipeline run. One of [`in_progress`, `success`, `failure`, `stopped`]
* **branch**: The git branch of the code that was ran during the specific pipeline run
* **tag** (*optional*): The git tag of the code that is being ran in the specific pipeline run
* **start_time** (*optional*): An ISO-8601 compliant timestamp that indicates the time the pipeline started
* **end_time**(*optional*): An ISO-8601 compliant timestamp that aligns with the pipeline end event
ISO-8601: To generate a timestamp of this format you can use the following bash command:
date +%Y-%m-%dT%H:%M:%SZ
2.) Run a pipeline and the project will be viewable within BuildBasis.
Timing data can be generated 2 ways.
Method 1. Send a curl request at the start and finish of your pipeline, with different status values and the BuildBasis platform will automatically calculate the elapsed time for a build.
Method 2. Send a single curl request with the resulting status and ISO-8601 compliant timestamp values for the start_time and end_time fields.
Note: Failure to use one of the 2 above described methods will result in timing data not being analyzed for those builds.