Uploading CI Build Data

Upload Example Using cURL

In the following, we provide an example of how to push your build-run information to 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 is below. Note, that the POST command includes the example API token lgca_UeRxFs_3RYRJEJtdYp7j7Wa6DirG5NjiYslsb and the example workspace myworkspace. The command URL also includes a placeholder for the repoID to associate the uploaded issues with.

curl --location --request POST 'https://logilica.io/api/import/v1/ci_build/<repoID>/create' \
--header 'X-lgca-token: lgca_UeRxFs_3RYRJEJtdYp7j7Wa6DirG5NjiYslsb' \
--header 'x-lgca-domain: myworkspace' \
--header 'Content-Type: application/json' \
--data-raw '[{
  "origin": "GITHUB_TEST",
  "originalID": "1691121120",
  "name": "Pull Request CI",
  "url": "https://github.com/logilica/example/actions/runs/1691121120",
  "createdAt": 1689207410,
  "startedAt": 1689208510,
  "completedAt": 1689209716,
  "triggeredBy": {
    "name": "Joe Doe",
    "email": "[email protected]",
    "accountId": "joe-doe",
    "lastActivity": 1679528275
  },
  "status": "completed",
  "conclusion": "success",
  "repoUrl" : "https://github.com/logilica/example",
  "commit": "c3de81aedf8461324021d61f4dca16dd742db215",
  "pullRequestUrls": [],
  "isDeployment": false,
  "stages": [
    {
      "id" : "4799033011",
      "name": "build / Build Logilica Insights",
      "startedAt": 1689208510,
      "completedAt": 1689209716,
      "status": "completed",
      "conclusion": "success",
      "url": "https://github.com/logilica/example/runs/4799033011?check_suite_focus=true",
      "jobs": [
        {
          "startedAt": 1689208510,
          "completedAt": 1689208540,
          "name": "Set up job",
          "status": "completed",
          "conclusion": "success"
        },
        {
          "startedAt": 1689208545,
          "completedAt": 1689209716,
          "name": "Run actions/checkout@v2",
          "status": "completed",
          "conclusion": "success"
        }
      ]
    }
  ]
}]'

API Schema for Importing CI Build Data

post

Create or update a CI build

Path parameters
repoIDstringRequired
Body
originstringRequired

The service / app that the build pipeline belongs to, e.g. 'GITHUB', 'GITLAB'

originalIDstringRequired

The ID of this build job with the service origin

namestringRequired

Name of the CI build

urlstring · uriRequired

The URL to which this CI build may be accessed

startedAtnumberRequired

UNIX timestamp of when the CI build began running

createdAtnumberRequired

UNIX timestamp of when the CI build was submitted

completedAtnumberRequired

UNIX timestamp of when the CI build ended

statusstringRequired

Status of the CI build, e.g. 'Completed', 'Running'

conclusionstringRequired

Outcome of the CI build, e.g. 'Success', 'Fail'

repoUrlstring · uriRequired

URL for the git repository this belongs to

commitstringRequired

The git commit hash that identifies the git commit this workflow run corresponds to

pullRequestUrlsstring[]Required

An array of URLs of pull requests that are linked to this CI build

isDeploymentbooleanRequired

Boolean indicating whether the CI build is a deployment run or not

Responses
200
Success in creating CI build
application/json
post
POST /api/import/v1/ci_build/{repoID}/create HTTP/1.1
Host: logilica.io
Content-Type: application/json
Accept: */*
Content-Length: 571

[
  {
    "origin": "text",
    "originalID": "text",
    "name": "text",
    "url": "https://example.com",
    "startedAt": 1,
    "createdAt": 1,
    "completedAt": 1,
    "triggeredBy": {
      "name": "text",
      "email": "[email protected]",
      "accountId": "text",
      "lastActivity": 1
    },
    "status": "text",
    "conclusion": "text",
    "repoUrl": "https://example.com",
    "commit": "text",
    "pullRequestUrls": [
      "text"
    ],
    "isDeployment": true,
    "stages": [
      {
        "name": "text",
        "id": "text",
        "url": "https://example.com",
        "startedAt": 1,
        "completedAt": 1,
        "status": "text",
        "conclusion": "text",
        "jobs": [
          {
            "name": "text",
            "startedAt": 1,
            "completedAt": 1,
            "status": "text",
            "conclusion": "text"
          }
        ]
      }
    ]
  }
]
{
  "warnings": {
    "message": "text",
    "ids": [
      "text"
    ]
  }
}

Questions?

If you have any questions or run into issues, please contact us at [email protected].

Last updated