CDEvents Integration

Uploading CI Builds to Logilica using CDEvents

CDEvents (Continuous Delivery Events) is a standardized event format for event-driven communication in CI/CD and DevOps systems. Designed to work with platforms like Tekton, Jenkins, ArgoCD, Flux, and other modern DevOps frameworks.

For further details on CDEvents, refer to the official CDEvents Specification.

Importing CDEvents Build Data

Before using this API, ensure that your CI/CD tooling is configured to emit CDEvents.

To ensure the accuracy of data in Logilica, CDEvents data should adhere to the following guide:

  1. Import a repository to Logilica and fetch the ID through the API or UI. You use this ID in subsequent calls to the Logilica Import API for CDEvents Data.

  2. Send CDEvents to the API. The API expects events in chronological order.

In Logilica, a CI build data entry is constructed across the ingestion of multiple CDEvents events. The creation of the complete CI build entry is triggered when an event with a type of dev.cdevents.pipelinerun.finished is received. Partial CI build entry records are not shown in the Logilica UI. The context.id field is used across the multiple CDEvent events to create one CI build entry in Logilica.

Mapping of CDEvents to Logilica CI Build

The following table outlines how CDEvents are mapped to the attributes of CI builds in Logilica. Each event contributes specific data that is aggregated to form a complete build record

Logilica CI Build
CDEvent Type
CDEvent Field

name

pipelinerun

pipelineName

url

pipelinerun

outcome

startedAt

pipelinerun

timestamp and type includes 'running'

createdAt

pipelinerun

timestamp and type includes 'queued'

completedAt

pipelinerun

timestamp and type includes 'completed'

stages

build

id, timestamp

repoUrl

repository

url

commit

change

id

triggeredBy

customData

pullRequestUrls

customData

In addition, Logilica's CDEvents integration supports the additional fields of triggeredBy and pullRequestUrls through the use of custom data field, specified in a JSON string format (refer to cURL example below).

Using custom data requires the CDEvents to have customDataContentType: "application/json"

Upload Example Using cURL

In the following, we provide an example of how to push your CDEvents data into Logilica for storage and built-in analytics.

Important: Ensure the repository you build from is already onboarded in Logilica. The Repositories API can be used to retrieve the repoId for the endpoint.

The cURL POST command has been provided below. Note, that the POST command uses example data, including the API token lgca_UeRxFs_3RYRJEJtdYp7j7Wa6DirG5NjiYslsb and the example workspace myworkspace. The command URL also includes a placeholder for the repoID to associate the uploaded CD Events with.

curl -L \
  --request POST \
  --url 'https://logilica.io/api/import/v1/cd_events/<repoID>/create' \
  --header 'X-lgca-token: lgca_UeRxFs_3RYRJEJtdYp7j7Wa6DirG5NjiYslsb' \
  --header 'x-lgca-domain: myworkspace' \
  --header 'Content-Type: application/json' \
  --data '{  
    "context": {
        "version": "0.1.2",
        "id": "event-123",
        "source": "/event/source/123",
        "type": "dev.cdevents.pipelinerun.finished",
        "timestamp": "2025-03-05T10:00:00Z"
    },
    "subject": {
        "id": "pipeline-123",
        "source": "/event/source/123",
        "type": "pipelineRun",
        "content": {
            "id": "pipeline-123",
            "source": "/event/source/123"",
            "type": "dev.cdevents.build.finished",
            "pipelineName": "example-pipeline",
            "url": "https://ci.example.com/pipeline/67890",
            "outcome": "success"
        }
    },
    "customData": "{\"triggeredBy\": \"John Doe\", \"pullRequestUrls\": [\"https://github.com/org/pull/123"]}",
    "customDataContentType": "application/json"
}'

API Schema for Importing CDEvents

Create a CDEvent

post

Create or update a CD event

Path parameters
repoIDstringRequired
Body
customDatastringOptional
customDataContentTypestringOptional
Responses
200
Success
application/json
post
POST /api/import/v1/cd_events/{repoID}/create HTTP/1.1
Host: logilica.io
Content-Type: application/json
Accept: */*
Content-Length: 460

{
  "context": {
    "id": "text",
    "type": "text",
    "source": "text",
    "timestamp": "text",
    "version": "text",
    "schemaUri": "text",
    "chainId": "text",
    "links": [
      {
        "linkType": "text",
        "linkKind": "text",
        "target": {
          "contextId": "text"
        },
        "from": {
          "contextId": "text"
        }
      }
    ]
  },
  "subject": {
    "id": "text",
    "content": {
      "id": "text",
      "source": "text",
      "type": "text",
      "pipelineName": "text",
      "url": "text",
      "outcome": "text",
      "errors": "text"
    },
    "source": "text",
    "type": "text"
  },
  "customData": "text",
  "customDataContentType": "text"
}
{
  "message": "text"
}

Last updated