Deployments not showing from Rest API

Phill Pafford
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 7, 2024

I'm sending DEPLOYMENT events using the Rest API but they are not showing up in my activity / timeline

 

NOTE: I see there are only 2 Environments I can see in the UI as well PRODUCTION and STAGING, so I just hard coded the environment to PRODUCTION and it's still not showing.

 

Here is an example request json object 

{

"cloudId": "123asd-1234-4321-wer-asd87asd78as",

"event": {

"deployment": {

"updateSequenceNumber": "76",

"displayName": "my project name",

"url": "https://bamboo/deploy/viewDeploymentResult.action?deploymentResultId=34177840",

"description": "project description",

"lastUpdated": "2024-10-04T21:16:57Z",

"externalEventSourceId": "project",

"deploymentProperties": {

"sequenceNumber": "76",

"state": "SUCCESSFUL",

"pipeline": {

"pipelineId": "KEY-PROJ-76",

"url": "https://bamboo/deploy/viewDeploymentResult.action?deploymentResultId=34177840",

"displayName": "develop-27"

},

"environment": {

"category": "PRODUCTION",

"displayName": "prod",

"environmentId": "develop-27"

}

}

}

},

"componentId": "ari:cloud:compass:123kj12l3k-1233-47d0-5435-sdfkljsdfi:component/asldkjas0-4343-4112-b44e-asdlkasd899/asdlkpi309-5e76-1234-9ba4-0eee32fdff21"

}

 

 

https://developer.atlassian.com/cloud/compass/rest/api-group-events/#api-compass-v1-events-post

using the JSON object from 

1 answer

1 accepted

2 votes
Answer accepted
Phill Pafford
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 7, 2024

after doing more testing, it sometimes works, but I think the events have to be unique, so redeploying the same build to the same environment doesn't add a new deployment event

Sebastian Hesse
Contributor
October 8, 2024

@Phill Pafford Are you incrementing the sequenceNumber or updateSequenceNumber ? At least the updateSequenceNumber has to be incremented each time you're intending to add a new deployment event. This is also documented in the API:

A number specifying the order of the update to the event. Must be incremented to save new events. Otherwise, the request will be ignored.

Like # people like this
Phill Pafford
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 8, 2024

.

Phill Pafford
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 8, 2024

@Sebastian Hesse you were right, I was using the build number which is the same for a deployment event, so I added the last 2 digits from a timestamp and appended the build number to make it unique

 

example

CURRENT_TIMESTAMP=$(date -u +'%Y-%m-%dT%H:%M:%SZ')
## append last 2 characters of the timestamp to build number so it's unique
UNIQUE_TZ=$(date +%s | tail -c -3)

COMPASS_DEPLOYMENT_UPDATE_SEQUENCE_NUMBER="${bamboo.buildNumber}$UNIQUE_TZ"
Like # people like this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events