Unable to find deployment notification with actual release version defined

I am in the process of configuring an Octopus webhook notification that will update an application record in ServiceNow using the info sent via the notification. The problem is that I want this notification sent when a deployment is successful so I can then get the application name and the release version that was deployed and use that to update the app’s ServiceNow record, but none of the notification payloads have the data pair that I want to make it easier to setup.

I did find the data pair in a release document notification for when a release is created. The code I am looking for is below in bold.

“ChangeDetails”: {
“DocumentContext”: {
“Id”: “Releases-86813”,
“SpaceId”: “Spaces-1”,
“ProjectId”: “Projects-2501”,
“ChannelId”: “Channels-2801”,
“Version”: “1.0.0.47-documenttest”,
“ReleaseNotes”: null,
“Assembled”: “2023-05-10T11:03:52.136-05:00”,
“ReleaseDefects”: [],
“DeploymentSettings”: {
“DefaultToSkipIfAlreadyInstalled”: false,
“ConnectivityPolicy”: {
“SkipMachineBehavior”: “None”,
“TargetRoles”: [],
“AllowDeploymentsToNoTargets”: false,
“ExcludeUnhealthyTargets”: false
},
“DefaultGuidedFailureMode”: “EnvironmentDefault”,
“DeploymentChangesTemplate”: null,
“VersioningStrategy”: {
“DonorPackage”: {
“DeploymentActionId”: “703024cc-eb38-41d6-9a62-c2aa5ba4cbff”,
“PackageReferenceId”: “a562056d-31a6-4f86-9d99-9c5e4ad450c8”
},
“Template”: null
},
“ForcePackageDownload”: false
},
“ProjectVariableSetSnapshotId”: “variableset-Projects-2501-s-0-N4HV6”,
“ProjectDeploymentProcessSnapshotId”: “deploymentprocess-Projects-2501-s-4-GLNCL”,
“LibraryVariableSetSnapshots”: [],
“ProvisioningRunbookProcessId”: null,
“DeprovisioningRunbookProcessId”: null,
“SelectedPackages”: [
{
“ActionName”: “Deploy a Package”,
“PackageReferenceName”: “”,
“Version”: “1.0.0.47”
}
],
“ProvisioningPackages”: [],
“DeprovisioningPackages”: [],
“BuildInformation”: [],
“VersionControlReference”: {
“VariablesGitCommit”: null,
“GitRef”: null,
“GitCommit”: null
}
},
“Differences”: []
},

Is there a way to configure a Release Successfully Deployed notification so that info is sent? Below is a sample of the payload from the successful deployment notification so you can see that the version is not defined the same way. The only place the version is mentioned is in the message body.

"Subscription": {
  "Id": "Subscriptions-41",
  "Name": "SN Test",
  "Type": "Event",
  "IsDisabled": false,
  "EventNotificationSubscription": {
    "Filter": {
      "Users": [],
      "Projects": [
        "Projects-2501"
      ],
      "ProjectGroups": [],
      "Environments": [],
      "EventGroups": [],
      "EventCategories": [
        "DeploymentSucceeded"
      ],
      "EventAgents": [],
      "Tenants": [],
      "Tags": [],
      "DocumentTypes": []
    },
    "EmailTeams": [
      "Teams-1022"
    ],
    "EmailFrequencyPeriod": "00:05:00",
    "EmailPriority": "Normal",
    "EmailDigestLastProcessed": "2023-05-10T10:50:38.078-05:00",
    "EmailDigestLastProcessedEventAutoId": 763513,
    "EmailShowDatesInTimeZoneId": "Central Standard Time",
    "WebhookURI": "https://webhook.site/5e08f2c1-9394-4a4f-a322-a56b92a21e3e",
    "WebhookTeams": [],
    "WebhookTimeout": "00:00:10",
    "WebhookHeaderKey": null,
    "WebhookHeaderValue": null,
    "WebhookLastProcessed": "2023-05-10T10:52:08.637-05:00",
    "WebhookLastProcessedEventAutoId": 763519
  },
  "SpaceId": "Spaces-1",
  "Links": {
    "Self": "/api/Spaces-1/subscriptions/Subscriptions-41"
  }
},
"Event": {
  "Id": "Events-686201",
  "RelatedDocumentIds": [
    "Deployments-143035",
    "Projects-2501",
    "Releases-86812",
    "Environments-1",
    "ServerTasks-338345",
    "Channels-2801"
  ],
  "Category": "DeploymentSucceeded",
  "UserId": "users-system",
  "Username": "system",
  "IsService": false,
  "IdentityEstablishedWith": "",
  "UserAgent": "Server",
  "Occurred": "2023-05-10T15:52:16.326+00:00",
  "Message": "Deploy to Dev succeeded for AuddlyApplicationTest release 1.0.0.47-payloadtest to Dev",
  "MessageHtml": "<a href='#/deployments/Deployments-143035'>Deploy to Dev</a> succeeded for <a href='#/projects/Projects-2501'>AuddlyApplicationTest</a> release <a href='#/releases/Releases-86812'>1.0.0.47-payloadtest</a> to <a href='#/environments/Environments-1'>Dev</a>",
  "MessageReferences": [
    {
      "ReferencedDocumentId": "Deployments-143035",
      "StartIndex": 0,
      "Length": 13
    },
    {
      "ReferencedDocumentId": "Projects-2501",
      "StartIndex": 28,
      "Length": 21
    },
    {
      "ReferencedDocumentId": "Releases-86812",
      "StartIndex": 58,
      "Length": 20
    },
    {
      "ReferencedDocumentId": "Environments-1",
      "StartIndex": 82,
      "Length": 3
    }
  ],
  "Comments": null,
  "Details": null,
  "ChangeDetails": {
    "DocumentContext": null,
    "Differences": null
  },
  "IpAddress": null,
  "SpaceId": "Spaces-1",
  "Links": {
    "Self": "/api/events/Events-686201"
  }
},

Hi @gmullins,

It looks like your questions here is a continuation of our previous conversation. Unfortunately, I don’t think we have a perfect solution to this right now. The information is technically sent in the payload but not in an easily consumable format.

The RelatedDocumentIds contains the Release-Id which can be used in the API to the full release object which has the version associated. Furthermore, the Message value mentions the release number, but this is designed as a human readable sting and doesn’t directly help in this situation.

I don’t have much ServiceNow experience, but I’m wondering if there are any options to integrate scripting with the payload value Octopus is sending it? If so, then you could use the Release-Id mentioned above to get the API results for that specific release and grab the value out.

I’m going to run this by the developers and see if there’s a reason we don’t put the release version in this payload. However, even if it’s an oversight, I can’t guarantee a quick turnaround on getting it added in.

Let me know if you have any questions on this.

Best regards,
Daniel

Yes, you are correct. It is further progress on that initial topic. Yes, scripted actions can be performed on ServiceNow’s end. I was hoping to avoid having to add any extra scripted actions but it seems like, for now, that may be the only way with things the way they are. :unamused:

I was assuming it was an oversight since it seems logical to have that same data included with deployment notifications. I will just go back to parsing an email sent from Octopus instead to update the records in ServiceNow. I will check back regularly to see if you add the data at some point so I can switch to using the webhook.

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.