Rollbar - Notify Deployment

Octopus.Script exported 2017-02-07 by sandord belongs to ‘Rollbar’ category.

Posts a deployment notification to Rollbar.

Parameters

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

Access Token

AccessToken =

Your project access token. Required.

Environment

Environment

Name of the environment being deployed, e.g. “production”. Required.

Revision

Revision

Revision number/sha being deployed. If using git, use the full sha. Required unless using Revision Filename.

Revision Filename

RevisionFilename

Name of a file to read revision number/sha being deployed from. If using git, use the full sha. Required unless using Revision.

Local Username

LocalUsername

User who deployed. Optional.

Rollbar Username

RollbarUsername

Rollbar username of the user who deployed. Optional.

Comment

Comment

Deploy comment (e.g. what is being deployed). Optional. Will be rendered as Rollbar-flavored Markdown.

URI

URI = https://api.rollbar.com/api/1/deploy/

Specifies the Rollbar API deploy endpoint.

Script body

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

try {
    $uri = $OctopusParameters["URI"];    
    $accessToken = $OctopusParameters["AccessToken"];
    $environment = $OctopusParameters["Environment"];
    $revision = $OctopusParameters["Revision"];
    $revisionFilename = $OctopusParameters["RevisionFilename"];
    $localUsername = $OctopusParameters["LocalUsername"];
    $rollbarUsername = $OctopusParameters["RollbarUsername"];
    $comment = $OctopusParameters["Comment"];
    
    if ($revisionFilename) {
        $revision = Get-Content $revisionFilename;
    }
    
    $arguments = "access_token=$accessToken&environment=$environment&revision=$revision&local_username=$localUsername&rollbar_username=$rollbarUsername&comment=$comment";
    
    Write-Host 'Notifying Deployment to Rollbar';
    Write-Host $arguments;
    
    (new-object net.webclient).UploadString($uri, $arguments);
    
} catch {
    $ErrorMessage = $_.Exception.Message;
    Write-Error $ErrorMessage;
}

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": "2b204b54-165f-4c5b-a856-ac932dfa979e",
  "Name": "Rollbar - Notify Deployment",
  "Description": "Posts a deployment notification to Rollbar.",
  "Version": 2,
  "ExportedAt": "2017-02-07T13:42:26.852Z",
  "ActionType": "Octopus.Script",
  "Author": "sandord",
  "Parameters": [
    {
      "Id": "8ad2b4ef-72c2-491a-8cc9-8034144f6580",
      "Name": "AccessToken",
      "Label": "Access Token",
      "HelpText": "Your project access token. Required.",
      "DefaultValue": "",
      "DisplaySettings": {
        "Octopus.ControlType": "SingleLineText"
      },
      "Links": {}
    },
    {
      "Id": "2252ae4e-d664-4b92-af45-1f8e4049afb1",
      "Name": "Environment",
      "Label": "Environment",
      "HelpText": "Name of the environment being deployed, e.g. \"production\". Required.",
      "DefaultValue": null,
      "DisplaySettings": {
        "Octopus.ControlType": "SingleLineText"
      },
      "Links": {}
    },
    {
      "Id": "47651ca8-9d07-4981-8aa6-c2ccee241bc9",
      "Name": "Revision",
      "Label": "Revision",
      "HelpText": "Revision number/sha being deployed. If using git, use the full sha. Required unless using Revision Filename.",
      "DefaultValue": null,
      "DisplaySettings": {
        "Octopus.ControlType": "SingleLineText"
      },
      "Links": {}
    },
    {
      "Id": "f8b27505-bac6-4690-b1f8-d171a3bc399a",
      "Name": "RevisionFilename",
      "Label": "Revision Filename",
      "HelpText": "Name of a file to read revision number/sha being deployed from. If using git, use the full sha. Required unless using Revision.",
      "DefaultValue": null,
      "DisplaySettings": {
        "Octopus.ControlType": "SingleLineText"
      },
      "Links": {}
    },
    {
      "Id": "2b5926f9-dde9-4abf-97e4-1e71e54ed19d",
      "Name": "LocalUsername",
      "Label": "Local Username",
      "HelpText": "User who deployed. Optional.",
      "DefaultValue": null,
      "DisplaySettings": {
        "Octopus.ControlType": "SingleLineText"
      },
      "Links": {}
    },
    {
      "Id": "5e2656b6-8d61-4813-83d0-cd3d3ff2e559",
      "Name": "RollbarUsername",
      "Label": "Rollbar Username",
      "HelpText": "Rollbar username of the user who deployed. Optional.",
      "DefaultValue": null,
      "DisplaySettings": {
        "Octopus.ControlType": "SingleLineText"
      },
      "Links": {}
    },
    {
      "Id": "81203f12-0c6e-4771-a205-ea9c69a6a3a3",
      "Name": "Comment",
      "Label": "Comment",
      "HelpText": "Deploy comment (e.g. what is being deployed). Optional. Will be rendered as Rollbar-flavored Markdown.",
      "DefaultValue": null,
      "DisplaySettings": {
        "Octopus.ControlType": "SingleLineText"
      },
      "Links": {}
    },
    {
      "Id": "03fcb027-dd94-49c0-9cb4-8b93771118cd",
      "Name": "URI",
      "Label": "URI",
      "HelpText": "Specifies the Rollbar API deploy endpoint.",
      "DefaultValue": "https://api.rollbar.com/api/1/deploy/",
      "DisplaySettings": {
        "Octopus.ControlType": "SingleLineText"
      },
      "Links": {}
    }
  ],
  "Properties": {
    "Octopus.Action.Script.ScriptBody": "try {\r    $uri = $OctopusParameters[\"URI\"];    \r    $accessToken = $OctopusParameters[\"AccessToken\"];\r    $environment = $OctopusParameters[\"Environment\"];\r    $revision = $OctopusParameters[\"Revision\"];\r    $revisionFilename = $OctopusParameters[\"RevisionFilename\"];\r    $localUsername = $OctopusParameters[\"LocalUsername\"];\r    $rollbarUsername = $OctopusParameters[\"RollbarUsername\"];\r    $comment = $OctopusParameters[\"Comment\"];\r    \r    if ($revisionFilename) {\r        $revision = Get-Content $revisionFilename;\r    }\r    \r    $arguments = \"access_token=$accessToken&environment=$environment&revision=$revision&local_username=$localUsername&rollbar_username=$rollbarUsername&comment=$comment\";\r    \r    Write-Host 'Notifying Deployment to Rollbar';\r    Write-Host $arguments;\r    \r    (new-object net.webclient).UploadString($uri, $arguments);\r    \r} catch {\r    $ErrorMessage = $_.Exception.Message;\r    Write-Error $ErrorMessage;\r}\r",
    "Octopus.Action.Script.Syntax": "PowerShell",
    "Octopus.Action.Script.ScriptSource": "Inline",
    "Octopus.Action.RunOnServer": "false",
    "Octopus.Action.Script.ScriptFileName": null,
    "Octopus.Action.Package.FeedId": null,
    "Octopus.Action.Package.PackageId": null
  },
  "Category": "Rollbar",
  "HistoryUrl": "https://github.com/OctopusDeploy/Library/commits/master/step-templates//opt/buildagent/work/75443764cd38076d/step-templates/rollbar-notify-deployment.json",
  "Website": "/step-templates/2b204b54-165f-4c5b-a856-ac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JdT3/bx9+8k4SHp29EZpiSgYx+0NMGvparZTBksN03GcX6LtEXXoXDVOlOTeZV9K0uuwH630jBvoeVamHr0cIIYQQQgghhNAgtFqtAGAD5kUAKDAvAkCBeREACsyLAFBgXgSAAvMiABSYFwGgwLwIAAXmRQAoMC8CQIF5EQAKzIsAUGBeBIAC8yIAFJgXAaDAvAgABeZFACgwLwJAgXkRAMTq0v8BWqOJzntv4GIAAAAASUVORK5CYII=",
  "$Meta": {
    "Type": "ActionTemplate"
  }
}

History

Page updated on Tuesday, February 7, 2017