Compass Rest API Build Events

I am pushing some build events to compass using postman. I followed the REST API guide and send the build events to compass. It doesn’t have the correct icon and the build success rate is wrong. The following curl command is used to send the build events to compass. (I put dummy values for privacy reasons) but the data are all correct and I don’t get any errors.

curl --request POST --url 'https://mydomain.atlassian.net/gateway/api/compass/v1/events' 
--user 'xxx@xxx.com-Token' 
--header 'Content-Type: application/json' 
--data '{
  "cloudId": "xxxx",
  "event": {
    "build": {
      "displayName": "buildEvent",
      "lastUpdated": "2023-11-21T00:45:53.3394497+00:00",
      "updateSequenceNumber": 1,
      "description": "Merge pull request",
      "url": "https://abcdefg.com/hijk",
      "externalEventSourceId": "0000",
      "buildProperties": {
        "state": "SUCCESSFUL",
        "pipeline": {
          "pipelineId": "123456"
        },
        "startedAt": "2023-11-21T00:45:36.0000000+00:00"
      }
    }
}'

Welcome to the Atlassian developer community @MHettiarachchige,

The symptoms you describe are a little vague. However, between the “success rate is wrong” and “don’t get any errors”, there is probably something wrong with the data itself, not the “shape of the data”. In other words, we can’t diagnose it with dummy data.

What might be the problem is something I’ve seen in the Jira Software Open DevOps REST API. Specifically, there are 2 fields that are responsible for “lining up” the data inside Compass that might be wrong and won’t cause any API-level errors:

  • externalEventSourceId: For the API, this is an arbitrary string. But for the data to match in Compass, the source IDs must be consistent for a source. A good identifier would be a DNS hostname, or, for a more multi-tenant situation, maybe a UUID that identifies you. (In Open DevOps, this field is not directly available; it’s part of the auth.)
  • updateSequenceNumber: For the API, this is an arbitrary integer. The Compass docs read, “A number specifying the order of the update to the event.” That might not fully convey the idea that it should be monotonically increasing. In short, each time you send a new event (for a given source), the number should be larger than the last time. If you are building a relatively stateless way to build the event, then Unix time (in milliseconds) is a pretty easy way to satisfy that requirement. (In Open DevOps, there is also a field named updateSequenceNumber and using the same number over and over will effectively overwrite the last event.)

Hope that helps.

Hi @ibuchanan

Thanks for your reply. I get the event on compass. But it appears as “other event” and has the following icon for it. Even though I send SUCCESSFUL as the state. I would like to see the green tick instead of this grey icon.