Skip to main content

Streaming Spinnaker Events to External Resources with Echo Event Filtering Plugin (PagerDuty)

Introduction

Spinnaker is a powerful and extensible continuous delivery platform that enables teams to automate software deployment and delivery.

One of its valuable features is the ability to stream events and notifications to various external systems, including PagerDuty, to keep stakeholders informed about the status of deployments and other critical actions. This article will explore how to configure Spinnaker to stream events to PagerDuty and filter those events using Armory's EventFilter Premium plugin.

We'll also delve into the use of templating and Jinja to customize event notifications.

Prerequisites

  • Permission to the Spinnaker application* PagerDuty token generated by an administrator* PagerDuty routing key for service generated by an administrator* Armory Event Filter Plugin installed. More information on the Event Filter plugin can be found at https://docs.armory.io/plugins/echo-event-filter/

Instructions

To begin streaming events to PagerDuty, administrators need to configure the Spinnaker setup accordingly. These configurations need to be added to the Echo profile under spec.spinnakerConfig.profiles.echo in the SpinnakerService.yml file under spec.spinnakerConfig.profiles.echo Armory's Event Filter plugin provides a powerful mechanism to filter events before they are sent to external systems like PagerDuty. By specifying filters, you can ensure that only relevant events trigger notifications. More information on the Event Filter plugin, as well as how to configure filters, can be found at https://docs.armory.io/plugins/echo-event-filter/Administrators will need to install the Event Filter Plugin and configure filters. The following needs to be added to the SpinnakerService.yml file:

spec:
spinnakerConfig:
profiles:
echo:
spinnaker:
extensibility:
plugins:
Armory.EventFilter:
enabled: true
version: 0.0.4
repositories:
eventfilter:
enabled: true
url:
event:
filters:
-

Administrators will also need to configure PagerDuty as a listening Webhook to Spinnaker. The yaml changes need to be added to the SpinnakerService.yml file.Please note that the example below needs to be modified based on the use case and requirements. In the example, we have configured our listener as the PagerDuty change events API and have configured a template. Templating allows you to customize the content and structure of the notifications sent to PagerDuty or other external systems. The Armory Echo Filter Plugin enables Jinja templating.  This enables extraction of event fields using dot notation and Jinja filters to enable custom formatted messages. The Jinja template includes placeholders such as {{ event.details.type }} and {{ event.details.application }}. When a notification is generated, these placeholders will be dynamically replaced with the corresponding values from the event. 

spec:
spinnakerConfig:
profiles:
echo:
rest:
templating:
jinjava:
enabled: true
enabled: true
endpoints:
- wrap: true
url: ""
headers:
Authorization: ""
template: '{"routing_key":"", "payload":{ "summary":"{{ event.details.type }} in application {{ event.details.application }} with executionID {{ event.content.executionId }} ", "custom_details": { "insert_key": "insert_value" } }, "links": [{"href": "{{ event.details.application }}/executions", "text": "Application link" }] }'
  • Once the configuration is completed, Spinnaker's data can be seen in PagerDuty.  As an example: Administrators can also utilize other event references, such as {{ event.details.context.output. }} allowing for a wide array of outputs.