So I saw this post the other day
https://community.atlassian.com/t5/Compass-articles/Using-Bamboo-and-Compass-Try-this/ba-p/2863449 and have a similar script, but something is not working as expected.
I'm seeing activity events for different components, example:
When viewing any of the components I see all three build events
NOTE: if I look at component D, I do not see any activity for A, B or C. But if I look at A, B or C I see all A, B and C events in any of the components
QUESTIONS
UPDATE:
so I tested adding 2 build events, one at the start and one at the end, but seeing the same results where the events are on all components and not just the specific component
here is my scripts
#!/usr/bin/env bash
set -e
## check to see if jq is installed
if ! command -v jq &> /dev/null
then
echo "jq not found, please install jq"
exit 1
fi
## https://acme.atlassian.net/_edge/tenant_info
CLOUD_ID="asdbre34-30c6-44ff-8ad2-7dsdasdasddd"
## find your comp0nent id here: https://acme.atlassian.net/compass/components
## use Config as Code to find it:
## https://acme.atlassian.net/compass/component/asdkljoi3-edb3-asdj4-9dd5-asdkjaskjd44/config-as-code
COMPONENT_ID="ari:cloud:compass:asdasdasd-30c6-44rr-8ad2-asdasdasd:component/ghjghjjh-25a6-4444-b44e-ghjghjhgj56/sdfsd55-edb3-333-9dd5-cvxcvfr4455"
## set these in bamboo as global variables
COMPASS_USER_EMAIL="${bamboo.compass.rest.api.user.email}"
COMPASS_USER_API_KEY="${bamboo.compass.rest.api.token}"
BAMBOO_BUILD_STATE=UNKNOWN
BUILD_STATUS=${bamboo_jobFailed}
## note there are other values that can be set for compass
## IN_PROGRESS, SUCCESSFUL, CANCELLED, FAILED, ERROR, TIMED_OUT, UNKNOWN
if [[ "$BUILD_STATUS" == "true" ]]
then
BAMBOO_BUILD_STATE=FAILED
else
BAMBOO_BUILD_STATE=SUCCESSFUL
fi
COMPASS_BUILD_TIMESTAMP_FINISHED=$(date -u +'%Y-%m-%dT%H:%M:%SZ')
COMPASS_BUILD_DISPLAY_NAME="BUILD: ${bamboo.buildPlanName}"
COMPASS_BUILD_UPDATE_SEQUENCE_NUMBER="${bamboo.buildNumber}"
COMPASS_BUILD_DESCRIPTION="${bamboo.planName}"
COMPASS_BUILD_URL="${bamboo.buildResultsUrl}"
COMPASS_BUILD_EXTERNAL_EVENT_SOURCE_ID="${bamboo.planRepository.branchDisplayName}"
COMPASS_BUILD_STARTED_AT="${bamboo.buildTimeStamp}"
COMPASS_BUILD_PIPELINE_ID="${bamboo.buildNumber}"
## data needs to be JSON, use JQ for this
COMPASS_EVENT_JSON_DATA=$( jq -n \
--arg cloudId "$CLOUD_ID" \
--arg cDisplayName "$COMPASS_BUILD_DISPLAY_NAME" \
--arg cLastUpdated "$COMPASS_BUILD_TIMESTAMP_FINISHED" \
--arg cUpdateSequenceNumber $COMPASS_BUILD_UPDATE_SEQUENCE_NUMBER \
--arg cDescription "$COMPASS_BUILD_DESCRIPTION" \
--arg cUrl "$COMPASS_BUILD_URL" \
--arg cExternalEventSourceId "$COMPASS_BUILD_EXTERNAL_EVENT_SOURCE_ID" \
--arg cState "$BAMBOO_BUILD_STATE" \
--arg cStartedAt "$COMPASS_BUILD_STARTED_AT" \
--arg cPipelinePipelineId "$COMPASS_BUILD_PIPELINE_ID" \
--arg componentId "$COMPONENT_ID" \
'{ cloudId: $cloudId, event: {build: {displayName: $cDisplayName, lastUpdated: $cLastUpdated, updateSequenceNumber: $cUpdateSequenceNumber, description: $cDescription, url: $cUrl, externalEventSourceId: $cExternalEventSourceId, buildProperties: {state: $cState, startedAt: $cStartedAt, pipeline: {pipelineId: $cPipelinePipelineId}}}}, componentId: $componentId}'
)
COMPASS_EVENT=`curl --request POST \
--url https://acme.atlassian.net/gateway/api/compass/v1/events \
--user $COMPASS_USER_EMAIL:$COMPASS_USER_API_KEY \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data "$COMPASS_EVENT_JSON_DATA"`
echo "COMPASS_EVENT: $COMPASS_EVENT"
{
"cloudId": "asdbre34-30c6-44ff-8ad2-7dsdasdasddd",
"event": {
"build": {
"displayName": "BUILD: ACME - Applications - docker build image",
"lastUpdated": "2024-11-08T20:50:36Z",
"updateSequenceNumber": "80",
"description": "ACME - Applications - buidling the docker image",
"url": "https://acme.bamboo.com/browse/ACME-JOB1-80",
"externalEventSourceId": "develop",
"buildProperties": {
"state": "SUCCESSFUL",
"startedAt": "2024-11-08T20:50:20.715Z",
"pipeline": {
"pipelineId": "80"
}
}
}
},
"componentId": "ari:cloud:compass:asdasdasd-30c6-44rr-8ad2-asdasdasd:component/ghjghjjh-25a6-4444-b44e-ghjghjhgj56/sdfsd55-edb3-333-9dd5-cvxcvfr4455"
}
@Josh Campbell any insight into my question?
related https://community.atlassian.com/t5/Compass-articles/Using-Bamboo-and-Compass-Try-this/ba-p/2863449
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.