Octopus Deploy Integration

Prev Next

Introduction

Octopus Deploy is an automated deployment and release-management tool used by continuous-delivery teams worldwide. With this integration, we enable DevOps teams to send events to the Catchpoint portal on every successful deployment. This adds a marker in the Catchpoint portal so that you can view different changes to the application and correlate the user experience after those changes.

Learn more about Events API and Running a Script Step.

Prerequisites

  1. Octopus development process.
  2. Catchpoint Events API ID and Secret.

Installation & Configuration

Getting Events API ID and Secret:

  1. Login to the Catchpoint portal.
  2. Go to Settings > API.
  3. Scroll to the Events API section.
  4. Capture the ID and Secret.

mceclip0.png

Configuration on Octopus Deploy:

  1. In Octopus, under your deployment process click ADD STEP.
  2. Click on Script.
  3. Click Add on Run a Script.
  4. Provide a Step Name.
  5. Choose Run on the Octopus Server.
  6. Choose Inline Script.
  7. Choose PowerShell.
  8. Paste this script into the editor.
Write-Host "Sending event in Catchpoint"

# Collect data to send to Catchpoint
$url = "https://r.3gl.net/hawklogserver/f.p"
$catchpointAuthToken = $OctopusParameters['CacthpointAPIToken']
$appId = [int]$OctopusParameters['CatchpointAppId']
# Event types: [1] Outage-ISP [2] Outage-Node [3] Outage-Provider [4] Configuration-Change [5] Upgrade-Hardware [6] Upgrade-Software [7] Patch-Security
$eventType = 6
$eventName = "Deployed : " + $OctopusParameters['Octopus.Release.Number'] + " - " + $OctopusParameters["Octopus.Release.Notes"]
$Time = Get-Date

# Build the payload
$payload = ConvertTo-Json @{
s = $appID
e = $eventType
d = $eventName
t = $Time.ToUniversalTime()
}

# Set the request headers.
$headers = @{
"Content-Type" = "application/json"
"Cp-Secret" = $catchpointAuthToken
}

#Make the request.
try {
Invoke-RestMethod -Uri $url -Body $payload -Method Post -Headers $headers
Write-Host "Sent Event in Catchpoint."
} catch {
Write-Host "Error received when sending event in Catchpoint: " $_
}
  1. Click Save.
  2. Click the 3 dots on the top right and select Extract Step Template.
  3. Click on the step name in blue to view the script.
  4. Click on PARAMETERS.
  5. Select ADD PARAMETER.
  6. Enter Variable name as "CatchpointAppId" and label as "Catchpoint App ID".
  7. Click ADD.
  8. Click ADD PARAMETER.
  9. Enter Variable name as "CatchpointAPIToken" and label as "Catchpoint API Token".
  10. Set Control type as Sensitive/password box.
  11. Click ADD.
  12. Click SAVE.
  13. Go back to the deployment step and click on the UPDATE button to get the latest version of the template.
  14. Click Confirm.
  15. Add CatchpointAppId and CatchpointAPIToken variable values which you captured from the Catchpoint Portal previously.
  16. Click SAVE.

Results

Once your Octopus deployment process executes, the step with the script should register events in Catchpoint about the release. You can navigate to the Catchpoint Dashboard and view the events widget to see these events.
mceclip1.png