elmah.io - Register Deployment

Octopus.Script exported 2021-09-03 by elmahio belongs to ‘ELMAH’ category.

Step template for notifying elmah.io about deployments on Octopus.

Parameters

When steps based on the template are included in a project’s deployment process, the parameters below can be set.

API Key

ApiKey

Required: Input your elmah.io API key located on the organization settings page.

Log ID

LogId

Optional: As default, new deployments are shown on all logs on the organization. If you want the deployment to show up on a single log only, input the ID of the log here.

Version

Version = #{Octopus.Release.Number}

Required: Let you input a version string to use when creating the deployment on elmah.io.

Script body

Steps based on this template will execute the following PowerShell script.

$version = $OctopusParameters['Version']
$url = 'https://api.elmah.io/v3/deployments?api_key=' + $OctopusParameters['ApiKey']
$body = @{
  version = $version
  description = $OctopusReleaseNotes
  userName = $OctopusParameters['Octopus.Deployment.CreatedBy.Username']
  userEmail = $OctopusParameters['Octopus.Deployment.CreatedBy.EmailAddress']
  logId = $OctopusParameters['LogId']
}
Try {
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12, [Net.SecurityProtocolType]::Tls11, [Net.SecurityProtocolType]::Tls
  Invoke-RestMethod -Method Post -Uri $url -Body $body
}
Catch {
  Write-Error $_.Exception.Message -ErrorAction Continue
}

Provided under the Apache License version 2.0.

Report an issue

To use this template in Octopus Deploy, copy the JSON below and paste it into the Library → Step templates → Import dialog.

{
  "Id": "8CA59AC6-11A5-4624-A019-E93C1BA5F03C",
  "Name": "elmah.io - Register Deployment",
  "Description": "Step template for notifying elmah.io about deployments on Octopus.",
  "Version": 7,
  "ExportedAt": "2021-09-03T08:34:01.363Z",
  "ActionType": "Octopus.Script",
  "Author": "elmahio",
  "Parameters": [
    {
      "Id": "0a3fe2a0-5c89-4e56-b1c3-b31bf4978ca4",
      "Name": "ApiKey",
      "Label": "API Key",
      "HelpText": "Required: Input your elmah.io API key located on the organization settings page.",
      "DefaultValue": null,
      "DisplaySettings": {
        "Octopus.ControlType": "Sensitive"
      }
    },
    {
      "Id": "63e08bca-37d8-45ca-bd41-912efa1dfb86",
      "Name": "LogId",
      "Label": "Log ID",
      "HelpText": "Optional: As default, new deployments are shown on all logs on the organization. If you want the deployment to show up on a single log only, input the ID of the log here.",
      "DefaultValue": null,
      "DisplaySettings": {
        "Octopus.ControlType": "SingleLineText"
      }
    },
    {
      "Id": "a75169a0-f829-4ad5-ab4b-c108cf2231e5",
      "Name": "Version",
      "Label": "Version",
      "HelpText": "Required: Let you input a version string to use when creating the deployment on elmah.io.",
      "DefaultValue": "#{Octopus.Release.Number}",
      "DisplaySettings": {
        "Octopus.ControlType": "SingleLineText"
      }
    }
  ],
  "Properties": {
    "Octopus.Action.Script.Syntax": "PowerShell",
    "Octopus.Action.Script.ScriptSource": "Inline",
    "Octopus.Action.RunOnServer": "false",
    "Octopus.Action.Script.ScriptBody": "$version = $OctopusParameters['Version']\n$url = 'https://api.elmah.io/v3/deployments?api_key=' + $OctopusParameters['ApiKey']\n$body = @{\n  version = $version\n  description = $OctopusReleaseNotes\n  userName = $OctopusParameters['Octopus.Deployment.CreatedBy.Username']\n  userEmail = $OctopusParameters['Octopus.Deployment.CreatedBy.EmailAddress']\n  logId = $OctopusParameters['LogId']\n}\nTry {\n[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12, [Net.SecurityProtocolType]::Tls11, [Net.SecurityProtocolType]::Tls\n  Invoke-RestMethod -Method Post -Uri $url -Body $body\n}\nCatch {\n  Write-Error $_.Exception.Message -ErrorAction Continue\n}",
    "Octopus.Action.Script.ScriptFileName": null,
    "Octopus.Action.Package.FeedId": null,
    "Octopus.Action.Package.PackageId": null
  },
  "Category": "ELMAH",
  "HistoryUrl": "https://github.com/OctopusDeploy/Library/commits/master/step-templates//opt/buildagent/work/75443764cd38076d/step-templates/elmahio-notify-deployment.json",
  "Website": "/step-templates/8CA59AC6-11A5-4624-A019-E93C1BA5F03C",
  "Logo": "iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAMAAACahl6sAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5cc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SfAHY/8i6pWrRKirr50IlQb9ot0QJ1hO59bk/OpViJqI3SW1Zz4VHwfalvH2NQLrEenmC9Rsk6GgR/fQRPMy8GyQNKyroX9e58p+AKxF2J7K806hKwA0PCYi/RV6zxknJikrKN+xxUS/Xep556qQ825frtKs2NcYnno1zdCqlYbcOO0oti0oxlxLoTCSjTqWYqfS2yLZvFftdm38pLWLofVAn5a1UtBWRXBLjVr8r85cOMHW2iCXVQ5VK4eXoG6mzRdgnxa+m8vDUaWh1Yi0R8JEP71L+78DxJYqpa0FUnsfs3i1YqhSeHwCjxSL6tt0QJHQwlX9fn7iHCjdb3d23NhuU2cBxvc0yiRzyKFfOvkXFfhd8HpczjLbYln5x+W6a57Eoi8+zQJZFG21efO2Q0nyPw/GpLOvhApgMkn9HRHADc/bkYVz8zzaDvAZe2ZWF/dxKJbTBKjZ7T7GVtYTM1ae/QVSKDk8wSMOjMdU/TM4wSMtpOw8UIW0bXKrtBxnUseqZPC6CXXk0r6Fxtfvy0Dzqft90HZRRA13pXT0D3WuRDildCr/V2b5uc5h3Pbf94TqjeO/Ic77GHP5PkeAFVHq9fg/kTC5d3+iKwOdESz7jFTw40bm97qcTpi75g197HAgEAoFAIBAIBAKBQCAQCAQCgUAgEAgEAoFAIPDf4p8AAwCtzTlV0SvdJgAAAABJRU5ErkJggg==",
  "$Meta": {
    "Type": "ActionTemplate"
  }
}

History

Page updated on Friday, September 3, 2021