Create configure8 API key
We will use the configure8 public API to create a service in the Catalog once the repository is created.
If you don't have a configure8 API Key, follow this guide to create a new one.
Action setup
1. Details
Go to your configure8 app in the Self-Service menu. Select the "+ Add Action" button.
Fill in your action Name, Type, Logo, Status, and Description.
2. Context
Set your action Owners, Visibility Control, Viewers, Allowed People, and Applies to fields.
3. User Input
Activate the user input toggle to insert the JSON for user input.
Paste the JSON below to visualize the inputs we ask of the user in this sample.
Copy [
{
"required" : true ,
"type" : "text" ,
"title" : "Service name" ,
"payloadName" : "service_name"
} ,
{
"type" : "text" ,
"title" : "Service description" ,
"payloadName" : "service_description"
} ,
{
"type" : "item-selector" ,
"title" : "Service repository" ,
"payloadName" : "service_repository" ,
"dataset" : {
"data" : "{{repositories()}}" ,
"value" : "id"
}
} ,
{
"type" : "item-selector" ,
"title" : "Service application" ,
"payloadName" : "service_application" ,
"dataset" : {
"data" : "{{applications()}}" ,
"value" : "id"
}
} ,
{
"type" : "text" ,
"title" : "Service link title" ,
"payloadName" : "service_link_title"
} ,
{
"type" : "dropdown" ,
"title" : "Service link type" ,
"payloadName" : "service_link_type" ,
"options" : [
{
"label" : "API" ,
"value" : "api"
} ,
{
"label" : "Dashboard" ,
"value" : "dashboard"
} ,
{
"label" : "Documentation" ,
"value" : "documentation"
} ,
{
"label" : "Health Check" ,
"value" : "healthCheck"
} ,
{
"label" : "Logs" ,
"value" : "logs"
} ,
{
"label" : "Metrics" ,
"value" : "metrics"
} ,
{
"label" : "Runbook" ,
"value" : "runbook"
} ,
{
"label" : "Other" ,
"value" : "other"
}
]
} ,
{
"type" : "url" ,
"title" : "Service link url" ,
"payloadName" : "service_link_url"
} ,
{
"type" : "item-selector" ,
"payloadName" : "service_environments" ,
"title" : "Service environments" ,
"multiple" : true ,
"dataset" : {
"data" : "{{environments()}}" ,
"value" : "id"
}
} ,
{
"type" : "multiple-dropdown" ,
"payloadName" : "service_owners" ,
"title" : "Service owners" ,
"options" : [
{
"label" : "User 1" ,
"value" : "f95e1046-4adf-4e7f-9a53-3d0d48dbc299"
}
]
} ,
{
"type" : "multiple-dropdown" ,
"payloadName" : "service_viewers" ,
"title" : "Service viewers" ,
"options" : [
{
"label" : "User 1" ,
"value" : "f95e1046-4adf-4e7f-9a53-3d0d48dbc299"
}
]
} ,
{
"title" : "Service visibility control" ,
"payloadName" : "service_visibility" ,
"helpText" : "Please choose visibility for this service" ,
"type" : "dropdown" ,
"options" : [
{
"label" : "Default (view)" ,
"value" : "inherit"
} ,
{
"label" : "Entier Organization" ,
"value" : "read"
} ,
{
"label" : "Restricted" ,
"value" : " "
}
]
} ,
{
"title" : "Service auto-map name" ,
"payloadName" : "service_automap_name" ,
"helpText" : "Please provide a auto-map name for relating this service with related environments" ,
"type" : "text"
} ,
{
"title" : "Service auto-map value" ,
"payloadName" : "service_automap_value" ,
"helpText" : "Please provide a auto-map value for relating this service with related environments" ,
"type" : "text"
} ,
{
"title" : "Service scorecard" ,
"payloadName" : "service_scorecard_id" ,
"type" : "item-selector" ,
"dataset" : {
"data" : "{{scorecards()}}" ,
"value" : "id"
}
} ,
{
"type" : "text" ,
"payloadName" : "pagerduty_oncall" ,
"title" : "PagerDuty Plugin Credential ID"
} ,
{
"type" : "text" ,
"payloadName" : "github" ,
"title" : "GitHub Plugin Credential ID"
} ,
{
"type" : "text" ,
"payloadName" : "datadog_slo" ,
"title" : "DataDog SLO Plugin Credential ID"
} ,
{
"type" : "text" ,
"payloadName" : "jira" ,
"title" : "Jira Plugin Credential ID"
} ,
{
"type" : "text" ,
"payloadName" : "sonar_credential_id" ,
"title" : "SonarCloud Plugin Credential ID"
} ,
{
"type" : "text" ,
"payloadName" : "sonar_organization_key" ,
"title" : "SonarCloud Plugin Organization key"
} ,
{
"type" : "text" ,
"payloadName" : "sonar_cloud_project" ,
"title" : "SonarCloud Plugin project"
} ,
{
"type" : "multiple-dropdown" ,
"payloadName" : "sonar_cloud_metrics" ,
"title" : "SonarCloud Plugin metrics" ,
"options" : [
{
"label" : "Accepted Issues" ,
"value" : "accepted_issues"
}
]
}
]
```
4. Method
Set the following values:
Webhook URL:
Copy https://api.github.com/repos/YOUR_USER/YOUR_REPO/actions/workflows/ssa-demo-create-service.yml/dispatches
Change the USER and REPO above to reflect your GitHub account. The workflow name (ssa-run-create-user-repository.yml) should be the same one created in the below section, Backend setup - create a workflow.
Copy {
"Authorization": "token ghp_YOUR_GITHUB_TOKEN",
"Accept": "application/vnd.github.v3+json"
}
Payload:
As GitHub doesn't support receiving more than 10 parameters in workflows, we are concatenating some of the parameters and will unpack them on the GitHub Actions side.
Copy {
"ref": "main",
"inputs": {
"public_api_token": "",
"c8-report-token": "{{c8ReportToken}}",
"reportUrl": "https://app.configure8.io/self-service/api/v1/reports/webhook",
"service_name": "{{service_name}}",
"service_data": "{\"service_description\":\"{{service_description}}\",\"service_repository\":\"{{service_repository}}\",\"service_application\":\"{{service_application}}\",\"service_link_title\":\"{{service_link_title}}\",\"service_link_type\":\"{{service_link_type}}\",\"service_link_url\":\"{{service_link_url}}\",\"service_environments\":\"{{service_environments}}\",\"service_owners\":\"{{service_owners}}\",\"service_viewers\":\"{{service_viewers}}\",\"service_visibility\":\"{{service_visibility}}\",\"service_automap_name\":\"{{service_automap_name}}\",\"service_automap_value\":\"{{service_automap_value}}\"}",
"plugins_data": "{\"service_scorecard_id\":\"{{service_scorecard_id}}\",\"pagerduty_oncall\":\"{{pagerduty_oncall}}\",\"github\":\"{{github}}\",\"datadog_slo\":\"{{datadog_slo}}\",\"jira\":\"{{jira}}\",\"sonar_credential_id\":\"{{sonar_credential_id}}\",\"sonar_organization_key\":\"{{sonar_organization_key}}\",\"sonar_cloud_project\":\"{{sonar_cloud_project}}\",\"sonar_cloud_metrics\":\"{{sonar_cloud_metrics}}}\""
}
}
```
Backend setup
Create a GitHub token
Go to your GitHub account and create a personal access token .
Create a repository or use an existing one
Create or use a repository that matches the YOUR_REPO name passed on the webhook URL .
Create a workflow to execute the action
Inside YOUR_REPO, create a new workflow with the same name we used in the Webhook URL, in this case, 'ssa-demo-create-service.yml' with the following content:
Copy name : Manual Trigger Workflow
on :
workflow_dispatch :
inputs :
public_api_token :
description : 'Configure8 Public API Token'
required : true
c8-report-token :
description : 'Configure8 Report Token'
required : true
reportUrl :
description : 'Configure8 Report URL'
required : true
service_name :
description : 'Service name'
required : true
service_data :
description : 'Service extra info'
default : '{}'
required : false
plugins_data :
description : 'Plugins to attach'
default : ''
required : false
jobs :
upsert_service :
runs-on : ubuntu-latest
permissions : write-all
steps :
- name : Print parameters
run : |
echo "Public API Token: ${{ github.event.inputs.public_api_token }}"
echo "Service name: ${{ github.event.inputs.service_name }}"
- name : Set start at
id : set_started_at
run : |
echo "::set-output name=startedAt::$(node -e 'console.log(new Date().toISOString())')"
- name : Set default status
id : status
run : |
echo "::set-output name=status::complete"
- name : Use NodeJS
uses : actions/setup-node@v2
- name : Get service data
id : get_service_data
run : |
apiKey="${{ github.event.inputs.public_api_token }}"
serviceName="${{ github.event.inputs.service_name }}"
serviceData='${{ github.event.inputs.service_data }}'
response=$(curl -X POST -H "api-key: $apiKey" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"searchTerms": "'"$serviceName"'"
}' \
"https://app.configure8.io/public/v1/catalog/entities")
# check if response has error statusCode in this schema: {"message":"Unauthorized","statusCode":401}
if [[ $(echo "$response" | jq '.statusCode') != "null" ]]; then
echo "::set-output name=status::error"
echo "::set-output name=error-message::$(echo "$response" | jq '.message')"
echo "::set-output name=error-status-code::$(echo "$response" | jq '.statusCode')"
exit 1
fi
serviceId=$(echo "$response" | jq '.items[] | select(.name == "'"$serviceName"'") | .id')
echo "::set-output name=service_id::$serviceId"
echo "::set-output name=service_name::$serviceName"
keys=("service_description" "service_repository" "service_application" "service_link_title" "service_link_url" "service_link_type" "service_visibility" "service_automap_name" "service_automap_value")
for key in "${keys[@]}"; do
value=$(echo "$serviceData" | jq -r ".$key")
echo "::set-output name=$key::$value"
done
keys=("service_environments" "service_owners" "service_viewers")
for key in "${keys[@]}"; do
value=$(echo "$serviceData" | jq -c ".$key")
echo "::set-output name=$key::$value"
done
- name : Get plugings data
if : github.event.inputs.plugins_data != ''
id : get_plugins_data
run : |
apiKey="${{ github.event.inputs.public_api_token }}"
pluginData='${{ github.event.inputs.plugins_data }}'
keys=("service_scorecard_id" "pagerduty_oncall" "github" "datadog_slo" "jira")
for key in "${keys[@]}"; do
value=$(echo "$serviceData" | jq -r ".$key")
echo "::set-output name=$key::$value"
done
- name : Create Permissions Variable
id : create_permissions
run : |
serviceOwners='${{ steps.get_service_data.outputs.service_owners }}'
serviceViewers='${{ steps.get_service_data.outputs.service_viewers }}'
# Start building the JSON object
permissionsJson='{}'
# Add permissions for serviceOwners
for ownerId in $(echo "$serviceOwners" | jq -r '.[]'); do
permissionsJson=$(echo "$permissionsJson" | jq --arg id "$ownerId" '. + {($id): ["read", "create", "modify", "delete", "execute"]}')
done
# Add permissions for serviceViewers
for viewerId in $(echo "$serviceViewers" | jq -r '.[]'); do
permissionsJson=$(echo "$permissionsJson" | jq --arg id "$viewerId" '. + {($id): ["read"]}')
done
echo "Permissions JSON: $permissionsJson"
# Set the output for use in other steps
echo "::set-output name=permissions::$(echo "$permissionsJson" | jq -c .)"
- name : Update Service
if : steps.get_service_data.outputs.service_id != ''
run : |
echo "Trying to update service with id: ${{ steps.get_service_data.outputs.service_id }}"
apiKey="${{ github.event.inputs.public_api_token }}"
response=$(curl -X PATCH -H "api-key: $apiKey" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"name": "${{ steps.get_service_data.outputs.service_name }}",
"description": "${{ steps.get_service_data.outputs.service_description }}",
"generalAccess": ["${{ steps.get_service_data.outputs.service_visibility }}"],
"permissions": ${{ steps.create_permissions.outputs.permissions }},
"links": [
{
"title": "${{ steps.get_service_data.outputs.service_link_title }}",
"url": "${{ steps.get_service_data.outputs.service_link_url }}",
"icon": "${{ steps.get_service_data.outputs.service_link_type }}"
}
],
"metaTags": [
{
"name": "${{ steps.get_service_data.outputs.service_automap_name }}",
"type": "AutoMap",
"value": "${{ steps.get_service_data.outputs.service_automap_value }}"
}
]
}' \
"https://app.configure8.io/public/v1/catalog/entities/service/${{ steps.get_service_data.outputs.service_id }}")
# check if response has error statusCode in this schema: {"message":"Unauthorized","statusCode":401}
if [[ $(echo "$response" | jq '.statusCode') != "null" ]]; then
echo "::set-output name=status::error"
echo "::set-output name=error-message::$(echo "$response" | jq '.message')"
echo "::set-output name=error-status-code::$(echo "$response" | jq '.statusCode')"
exit 1
fi
- name : Create Service
id : create_service
if : steps.get_service_data.outputs.service_id == ''
run : |
echo "Trying to create service with name: ${{ steps.get_service_data.outputs.service_name }}"
apiKey="${{ github.event.inputs.public_api_token }}"
response=$(curl -X POST -H "api-key: $apiKey" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"name": "${{ steps.get_service_data.outputs.service_name }}",
"description": "${{ steps.get_service_data.outputs.service_description }}",
"generalAccess": ["${{ steps.get_service_data.outputs.service_visibility }}"],
"permissions": ${{ steps.create_permissions.outputs.permissions }},
"links": [
{
"title": "${{ steps.get_service_data.outputs.service_link_title }}",
"url": "${{ steps.get_service_data.outputs.service_link_url }}",
"icon": "${{ steps.get_service_data.outputs.service_link_type }}"
}
],
"metaTags": [
{
"name": "${{ steps.get_service_data.outputs.service_automap_name }}",
"type": "AutoMap",
"value": "${{ steps.get_service_data.outputs.service_automap_value }}"
}
]
}' \
"https://app.configure8.io/public/v1/catalog/entities/service/")
# check if response has error statusCode in this schema: {"message":"Unauthorized","statusCode":401}
if [[ $(echo "$response" | jq '.statusCode') != "null" ]]; then
echo "::set-output name=status::error"
echo "::set-output name=error-message::$(echo "$response" | jq '.message')"
echo "::set-output name=error-status-code::$(echo "$response" | jq '.statusCode')"
exit 1
fi
serviceId=$(echo "$response" | jq '.id')
echo "::set-output name=service_id::$serviceId"
- name : Get service ID
id : get_service_id
run : |
if [ -n "${{ steps.get_service_data.outputs.service_id }}" ]; then
serviceId="${{ steps.get_service_data.outputs.service_id }}"
elif [ -n "${{ steps.create_service.outputs.service_id }}" ]; then
serviceId="${{ steps.create_service.outputs.service_id }}"
else
serviceId=""
fi
echo "::set-output name=service_id::$serviceId"
- name : Attach Repository
if : steps.get_service_id.outputs.service_id != '' && steps.get_service_data.outputs.service_repository != ''
run : |
echo "Trying to attach repository with id ${{ steps.get_service_data.outputs.service_repository }} to service with id: ${{ steps.get_service_id.outputs.service_id }}"
apiKey="${{ github.event.inputs.public_api_token }}"
response=$(curl -X POST -H "api-key: $apiKey" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Step: Attach Repository" \
-d '{
"sourceEntityId": "${{ steps.get_service_id.outputs.service_id }}",
"targetEntityId": "${{ steps.get_service_data.outputs.service_repository }}"
}' \
"https://app.configure8.io/public/v1/catalog/relations")
# check if response has error statusCode in this schema: {"message":"Unauthorized","statusCode":401}
if [[ $(echo "$response" | jq '.statusCode') != "null" ]]; then
echo "::set-output name=status::error"
echo "::set-output name=error-message::$(echo "$response" | jq '.message')"
echo "::set-output name=error-status-code::$(echo "$response" | jq '.statusCode')"
exit 1
fi
- name : Attach Application
if : steps.get_service_id.outputs.service_id != '' && steps.get_service_data.outputs.service_application != ''
run : |
echo "Trying to attach application with id ${{ steps.get_service_data.outputs.service_application }} to service with id ${{ steps.get_service_id.outputs.service_id }}"
apiKey="${{ github.event.inputs.public_api_token }}"
response=$(curl -X POST -H "api-key: $apiKey" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Step: Attach Application" \
-d '{
"serviceId": "${{ steps.get_service_id.outputs.service_id }}",
"sourceEntityId": "${{ steps.get_service_id.outputs.service_id }}",
"targetEntityId": "${{ steps.get_service_data.outputs.service_application }}"
}' \
"https://app.configure8.io/public/v1/catalog/relations")
# check if response has error statusCode in this schema: {"message":"Unauthorized","statusCode":401}
if [[ $(echo "$response" | jq '.statusCode') != "null" ]]; then
echo "::set-output name=status::error"
echo "::set-output name=error-message::$(echo "$response" | jq '.message')"
echo "::set-output name=error-status-code::$(echo "$response" | jq '.statusCode')"
exit 1
fi
- name : Attach Environment
if : steps.get_service_id.outputs.service_id != ''
run : |
apiKey="${{ github.event.inputs.public_api_token }}"
serviceEnvironmentsJson='${{ steps.get_service_data.outputs.service_environments }}'
# Convert the JSON array to a Bash array
readarray -t environments < <(echo "$serviceEnvironmentsJson" | jq -r '.[]')
for envId in "${environments[@]}"
do
echo "Trying to attach environment with id $envId to service with id $serviceId"
response=$(curl -X POST -H "api-key: $apiKey" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Step: Attach Environment $envId" \
-d '{
"serviceId": "${{ steps.get_service_id.outputs.service_id }}",
"sourceEntityId": "${{ steps.get_service_id.outputs.service_id }}",
"targetEntityId": "'$envId'"
}' \
"https://app.configure8.io/public/v1/catalog/relations")
# check if response has error statusCode in this schema: {"message":"Unauthorized","statusCode":401}
if [[ $(echo "$response" | jq '.statusCode') != "null" ]]; then
echo "::set-output name=status::error"
echo "::set-output name=error-message::$(echo "$response" | jq '.message')"
echo "::set-output name=error-status-code::$(echo "$response" | jq '.statusCode')"
exit 1
fi
done
- name : Attach Scorecard (if exists)
if : steps.get_service_id.outputs.service_id != '' && steps.get_plugins_data.outputs.service_scorecard_id != ''
id : attach_plugins_aws_security_hub
run : |
apiKey="${{ github.event.inputs.public_api_token }}"
providerName="Scorecards"
providerType="OTHER"
serviceId=${{ steps.get_service_id.outputs.service_id }}
status="ACTIVE"
title="Scorecards"
uiPluginName="scorecards"
scorecardId=${{ steps.get_plugins_data.outputs.service_scorecard_id }}
response=$(curl -X GET -H "Content-Type: application/json" -H "api-key: $apiKey" \
"https://app.configure8.io/public/v1/scorecards/$scorecardId")
scorecardName=$(echo "$response" | jq -r '.name')
scorecardDescr=$(echo "$response" | jq -r '.description')
scorecardIcon=$(echo "$response" | jq -r '.icon')
scorecardStatus=$(echo "$response" | jq -r '.status')
scorecardServices=$(echo "$response" | jq -r '.services')
scorecardMetrics=$(echo "$response" | jq -r '.metrics')
# Append the newly generated UUID to the services array
scorecardServices=$(jq -n --argjson services "$scorecardServices" --arg newserviceid "$serviceId" '$services + [$newserviceid]')
scorecardServices=$(echo "$scorecardServices" | jq -c .)
echo "Trying to attach scorecard with id $scorecardId to service with id $serviceId"
echo "Scorecard services: $scorecardServices"
request_body=$(jq -n --arg desc "$scorecardDescr" --arg icon "$scorecardIcon" \
--argjson metrics "$scorecardMetrics" --arg name "$scorecardName" \
--argjson services "$scorecardServices" --arg status "$scorecardStatus" \
'{ "description": $desc, "icon": $icon, "metrics": $metrics, "name": $name, "services": $services, "status": $status }')
response=$(curl -X PUT -H "Content-Type: application/json" -H "api-key: $apiKey" \
-d "$request_body" \
"https://app.configure8.io/public/v1/scorecards/$scorecardId")
# Create the request_body
request_body=$(cat <<EOF
{
"configuration": [],
"layout": {
"h": 0,
"w": 0,
"x": 0,
"y": 0
},
"providerName": "$providerName",
"providerType": "$providerType",
"serviceId": "$serviceId",
"status": "$status",
"title": "$title",
"uiPluginName": "$uiPluginName"
}
EOF
)
response=$(curl -X POST -H "Content-Type: application/json" -H "api-key: $apiKey" \
-d "$request_body" \
"https://app.configure8.io/public/v1/module-settings")
- name : Attach PagerDuty OnCall plugin
if : steps.get_service_id.outputs.service_id != '' && steps.get_plugins_data.outputs.pagerduty_oncall != ''
id : attach_plugins_pagerduty_oncall
run : |
apiKey="${{ github.event.inputs.public_api_token }}"
providerName="PagerDuty OnCall"
providerType="OTHER"
serviceId=${{ steps.get_service_id.outputs.service_id }}
credentialId=${{ steps.get_plugins_data.outputs.pagerduty_oncall }}
status="ACTIVE"
title="PagerDuty OnCall"
uiPluginName="pagerduty-oncall"
# Create the request_body
request_body=$(cat <<EOF
{
"configuration": [],
"layout": {
"h": 0,
"w": 0,
"x": 0,
"y": 0
},
"credentialId": "$credentialId",
"providerName": "$providerName",
"providerType": "$providerType",
"serviceId": "$serviceId",
"status": "$status",
"title": "$title",
"uiPluginName": "$uiPluginName"
}
EOF
)
response=$(curl -X POST -H "Content-Type: application/json" -H "api-key: $apiKey" \
-d "$request_body" \
"https://app.configure8.io/public/v1/module-settings")
- name : Attach Github activity plugin
if : steps.get_service_id.outputs.service_id != '' && steps.get_plugins_data.outputs.github != ''
id : attach_plugins_github_activity
run : |
apiKey="${{ github.event.inputs.public_api_token }}"
providerName="GitHub"
providerType="REPOS"
serviceId=${{ steps.get_service_id.outputs.service_id }}
credentialId=${{ steps.get_plugins_data.outputs.github }}
status="ACTIVE"
title="GitHub Activity"
uiPluginName="github_activity"
# Create the request_body
request_body=$(cat <<EOF
{
"configuration": [],
"layout": {
"h": 0,
"w": 0,
"x": 0,
"y": 0
},
"credentialId": "$credentialId",
"providerName": "$providerName",
"providerType": "$providerType",
"serviceId": "$serviceId",
"status": "$status",
"title": "$title",
"uiPluginName": "$uiPluginName"
}
EOF
)
response=$(curl -X POST -H "Content-Type: application/json" -H "api-key: $apiKey" \
-d "$request_body" \
"https://app.configure8.io/public/v1/module-settings")
- name : Attach Github actions plugin
if : steps.get_service_id.outputs.service_id != '' && steps.get_plugins_data.outputs.github != ''
id : attach_plugins_github_actions
run : |
apiKey="${{ github.event.inputs.public_api_token }}"
providerName="GitHub"
providerType="REPOS"
serviceId=${{ steps.get_service_id.outputs.service_id }}
credentialId=${{ steps.get_plugins_data.outputs.github }}
status="ACTIVE"
title="GitHub Actions"
uiPluginName="github_actions"
# Create the request_body
request_body=$(cat <<EOF
{
"configuration": [],
"layout": {
"h": 0,
"w": 0,
"x": 0,
"y": 0
},
"credentialId": "$credentialId",
"providerName": "$providerName",
"providerType": "$providerType",
"serviceId": "$serviceId",
"status": "$status",
"title": "$title",
"uiPluginName": "$uiPluginName"
}
EOF
)
response=$(curl -X POST -H "Content-Type: application/json" -H "api-key: $apiKey" \
-d "$request_body" \
"https://app.configure8.io/public/v1/module-settings")
- name : Attach Datadog SLO plugin
if : steps.get_service_id.outputs.service_id != '' && steps.get_plugins_data.outputs.datadog_slo != ''
id : attach_plugins_datadog_slo
run : |
apiKey="${{ github.event.inputs.public_api_token }}"
providerName="Datadog"
providerType="OTHER"
serviceId=${{ steps.get_service_id.outputs.service_id }}
credentialId=${{ steps.get_plugins_data.outputs.datadog_slo }}
status="ACTIVE"
title="Datadog SLO"
uiPluginName="datadog_slo"
# Create the request_body
request_body=$(cat <<EOF
{
"configuration": [
{
"name": "slo_ids",
"value": ""
}
],
"layout": {
"h": 0,
"w": 0,
"x": 0,
"y": 0
},
"credentialId": "$credentialId",
"providerName": "$providerName",
"providerType": "$providerType",
"serviceId": "$serviceId",
"status": "$status",
"title": "$title",
"uiPluginName": "$uiPluginName"
}
EOF
)
response=$(curl -X POST -H "Content-Type: application/json" -H "api-key: $apiKey" \
-d "$request_body" \
"https://app.configure8.io/public/v1/module-settings")
- name : Attach Jira plugin
if : steps.get_service_id.outputs.service_id != '' && steps.get_plugins_data.outputs.jira != ''
id : attach_plugins_jira
run : |
apiKey="${{ github.event.inputs.public_api_token }}"
providerName="Jira"
providerType="ISSUE_TRACKING"
serviceId=${{ steps.get_service_id.outputs.service_id }}
credentialId=${{ steps.get_plugins_data.outputs.jira }}
status="ACTIVE"
title="Jira Activity"
uiPluginName="jira_activity"
# Create the request_body
request_body=$(cat <<EOF
{
"configuration": [
{
"name": "project_key",
"value": ""
}
],
"layout": {
"h": 0,
"w": 0,
"x": 0,
"y": 0
},
"credentialId": "$credentialId",
"providerName": "$providerName",
"providerType": "$providerType",
"serviceId": "$serviceId",
"status": "$status",
"title": "$title",
"uiPluginName": "$uiPluginName"
}
EOF
)
response=$(curl -X POST -H "Content-Type: application/json" -H "api-key: $apiKey" \
-d "$request_body" \
"https://app.configure8.io/public/v1/module-settings")
- name : Set completedAt
id : set_completed_at
run : |
echo "::set-output name=completedAt::$(node -e 'console.log(new Date().toISOString())')"
- name : Send results over HTTP
run : |
token="${{ github.event.inputs.c8-report-token }}"
reportUrl="${{ github.event.inputs.reportUrl }}"
status="${{ steps.status.outputs.status }}"
startedAt="${{ steps.set_started_at.outputs.startedAt }}"
completedAt="${{ steps.set_completed_at.outputs.completedAt }}"
# Report SSA result
if ! curl -X POST \
-H "c8-report-token: $token" \
-H "Content-Type: application/json" \
-d "{\"status\": \"$status\", \"startedAt\": \"$startedAt\", \"completedAt\": \"$completedAt\"}" \
"$reportUrl"; then
echo "Failed to send results over HTTP"
exit 1
fi
Run Action and view results
Owners and allowed users will be able to see the results after executing the action: