Is there a way in compass to view all the incoming requests for events and metrics?
currently I'm sending events for deployment and I'm getting a 200 response, but nothing is showing up in the activity feed timeline for my component
example deployment event object
{
"cloudId": "123123123-4444-aaaa-bbbb-123456789012",
"event": {
"deployment": {
"updateSequenceNumber": "594",
"displayName": "DEPLOYMENT: ACME - acme-api",
"url": "https://acme.com/deploy/viewDeploymentResult.action?deploymentResultId=34178993",
"description": "ACME - APIs - acme-api - 2.1.0",
"lastUpdated": "2024-11-11T20:08:14Z",
"externalEventSourceId": "2.1.0",
"deploymentProperties": {
"sequenceNumber": "594",
"state": "SUCCESSFUL",
"pipeline": {
"pipelineId": "5",
"url": "https://acme.com/deploy/viewDeploymentResult.action?deploymentResultId=34178993",
"displayName": "master-2.1.0"
},
"environment": {
"category": "PRODUCTION",
"displayName": "acme - acme-api - production",
"environmentId": "master-2.1.0"
}
}
}
},
"componentId": "ari:cloud:compass:123123123-4444-aaaa-bbbb-123456789012:component/b123123123-4444-aaaa-bbbb-123456789012/123123123-4444-aaaa-bbbb-123456789012"
}
#!/usr/bin/env bash
set -e
## https://acme.atlassian.net/_edge/tenant_info
CLOUD_ID="123123123-4444-aaaa-bbbb-123456789012"
## find your compenent id here: https://acme.atlassian.net/compass/components
## use Config as Code to find it:
## https://acme.atlassian.net/compass/component/849b19c0-edb3-486c-9dd5-4d08be48d4b6/config-as-code
COMPONENT_ID="ari:cloud:compass:12345678-dddd-eeee-ffff-123456789012:component/12345678-gggg-hhhh-iiii-123456789012/12345678-aaaa-bbbb-cccc-123456789012"
## create these as globale variables in bamboo
COMPASS_USER_EMAIL="${bamboo.compass.rest.api.user.email}"
COMPASS_USER_TOKEN="${bamboo.compass.rest.api.token}"
BAMBOO_BUILD_STATE=UNKNOWN
BUILD_STATUS=${bamboo_jobFailed}
## note there are other values that can be set for compass
## PENDING, IN_PROGRESS, SUCCESSFUL, CANCELLED, FAILED, ROLLED_BACK, UNKNOWN
if [ "$BUILD_STATUS" = true ]
then
BAMBOO_BUILD_STATE=FAILED
else
BAMBOO_BUILD_STATE=SUCCESSFUL
if [ "${bamboo.deploy.rollback}" = true ]
then
BAMBOO_BUILD_STATE=ROLLED_BACK
fi
fi
## get the environment from custom variable
## dev, qa, pilot, stage, prod
DEPLOYEMNT_ENVIRONMENT=${bamboo.environment}
echo "DEPLOYEMNT_ENVIRONMENT: $DEPLOYEMNT_ENVIRONMENT"
## envrinment category map
## PRODUCTION, STAGING, TESTING, DEVELOPMENT, UNMAPPED
COMPASS_DEPLOYMENT_PROPERTIES_ENVIRONMENT_CATEGORY=UNMAPPED
if [ "$DEPLOYEMNT_ENVIRONMENT" = "dev" ]
then
COMPASS_DEPLOYMENT_PROPERTIES_ENVIRONMENT_CATEGORY=DEVELOPMENT
elif [ "$DEPLOYEMNT_ENVIRONMENT" = "qa" ]
then
COMPASS_DEPLOYMENT_PROPERTIES_ENVIRONMENT_CATEGORY=TESTING
elif [ "$DEPLOYEMNT_ENVIRONMENT" = "pilot" ]
then
COMPASS_DEPLOYMENT_PROPERTIES_ENVIRONMENT_CATEGORY=STAGING
elif [ "$DEPLOYEMNT_ENVIRONMENT" = "beta" ]
then
COMPASS_DEPLOYMENT_PROPERTIES_ENVIRONMENT_CATEGORY=STAGING
elif [ "$DEPLOYEMNT_ENVIRONMENT" = "prod" ]
then
COMPASS_DEPLOYMENT_PROPERTIES_ENVIRONMENT_CATEGORY=PRODUCTION
fi
## force it to prod to test
COMPASS_DEPLOYMENT_PROPERTIES_ENVIRONMENT_CATEGORY=PRODUCTION
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)
UNIQUE_SEQUENCE_NUMBER="${bamboo.buildNumber}$UNIQUE_TZ"
COMPASS_DEPLOYMENT_UPDATE_SEQUENCE_NUMBER="$UNIQUE_SEQUENCE_NUMBER"
COMPASS_DEPLOYMENT_DISPLAY_NAME="DEPLOYMENT: ${bamboo.deploy.project}"
COMPASS_DEPLOYMENT_URL="${bamboo.resultsUrl}"
COMPASS_DEPLOYMENT_DESCRIPTION="${bamboo.planName}"
## custom variable we use to track the version
COMPASS_DEPLOYMENT_EXTERNAL_EVENT_SOURCE_ID="${bamboo.inject.version}"
COMPASS_DEPLOYMENT_PROPERTIES_SEQUENCE_NUMBER="$UNIQUE_SEQUENCE_NUMBER"
COMPASS_DEPLOYMENT_PROPERTIES_STATE="$BAMBOO_BUILD_STATE"
COMPASS_DEPLOYMENT_PROPERTIES_PIPELINE_PIPELINE_ID="${bamboo.buildNumber}"
COMPASS_DEPLOYMENT_PROPERTIES_PIPELINE_URL="${bamboo.resultsUrl}"
COMPASS_DEPLOYMENT_PROPERTIES_PIPELINE_DISPLAY_NAME="${bamboo.deploy.release}"
COMPASS_DEPLOYMENT_PROPERTIES_ENVIRONMENT_DISPLAY_NAME="${bamboo.deploy.environment}"
COMPASS_DEPLOYMENT_PROPERTIES_ENVIRONMENT_ENVIRONMENT_ID="${bamboo.deploy.version}"
COMPASS_EVENT_JSON_DATA=$( jq -n \
--arg cloudId "$CLOUD_ID" \
--arg dUpdateSequenceNumber $COMPASS_DEPLOYMENT_UPDATE_SEQUENCE_NUMBER \
--arg dDisplayName "$COMPASS_DEPLOYMENT_DISPLAY_NAME" \
--arg dUrl "$COMPASS_DEPLOYMENT_URL" \
--arg dDescription "$COMPASS_DEPLOYMENT_DESCRIPTION" \
--arg dLastUpdated "$CURRENT_TIMESTAMP" \
--arg dExternalEventSourceId "$COMPASS_DEPLOYMENT_EXTERNAL_EVENT_SOURCE_ID" \
--arg dSequenceNumber "$COMPASS_DEPLOYMENT_PROPERTIES_SEQUENCE_NUMBER" \
--arg dState "$COMPASS_DEPLOYMENT_PROPERTIES_STATE" \
--arg pPipelineId "$COMPASS_DEPLOYMENT_PROPERTIES_PIPELINE_PIPELINE_ID" \
--arg pUrl "$COMPASS_DEPLOYMENT_PROPERTIES_PIPELINE_URL" \
--arg pDisplayName "$COMPASS_DEPLOYMENT_PROPERTIES_PIPELINE_DISPLAY_NAME" \
--arg eCategory "$COMPASS_DEPLOYMENT_PROPERTIES_ENVIRONMENT_CATEGORY" \
--arg eDisplayName "$COMPASS_DEPLOYMENT_PROPERTIES_ENVIRONMENT_DISPLAY_NAME" \
--arg eEnvironmentId "$COMPASS_DEPLOYMENT_PROPERTIES_ENVIRONMENT_ENVIRONMENT_ID" \
--arg componentId "$COMPONENT_ID" \
'{"cloudId": $cloudId,"event": {"deployment": {"updateSequenceNumber": $dUpdateSequenceNumber,"displayName": $dDisplayName,"url": $dUrl,"description": $dDescription,"lastUpdated": $dLastUpdated,"externalEventSourceId": $dExternalEventSourceId, "deploymentProperties": {"sequenceNumber": $dSequenceNumber,"state": $dState,"pipeline": {"pipelineId": $pPipelineId,"url": $pUrl,"displayName": $pDisplayName},"environment": {"category": $eCategory,"displayName": $eDisplayName,"environmentId": $eEnvironmentId}}}}, componentId: $componentId}'
)
## debug JSON object in request
echo "COMPASS_EVENT_JSON_DATA: $COMPASS_EVENT_JSON_DATA"
COMPASS_EVENT=`curl --request POST \
--url https://acme.atlassian.net/gateway/api/compass/v1/events \
--user $COMPASS_USER_EMAIL:$COMPASS_USER_TOKEN \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data "$COMPASS_EVENT_JSON_DATA"`
## if 200 response, nothing comes back from compass
echo "COMPASS_EVENT: $COMPASS_EVENT"
:( it was a PEBKAC as I had the wrong component id
But I still think this would have been helpful to have a debug console in compass to view all the incoming requests, would have found my issue sooner
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.