Out of the box, Spinnaker allows you to configure the following types of notifications:
- SMS via Twilio
- Hello everybody! Many of the people who learn to sail have the dream to live aboard a sailboat one day or even to sail the world.
- Install Spinnaker in a Multipass VM. Minnaker is an open source tool that installs the latest release of Spinnaker and Halyard on Lightweight Kubernetes (K3s). Launch a Multipass VM with 2 cores, 10GB of memory, 30GB of storage.
This is discussed in the Configuring Notifications section below.
Additionally, Spinnaker allows you to set webhooks for git triggers. See the Setting up Git Triggers in Spinnaker section.
A spinnaker is a sail designed specifically for sailing off the wind from a reaching course to a downwind, i.e. With the wind 90–180° off bow.The spinnaker fills with wind and balloons out in front of the boat when it is deployed, called flying. Dinghy sailing with a spinnaker is so much fun. Here, we go back to basics with a quick guide to asymmetric spinnaker flying.
You can also set Spinnaker to stream all its events to a downstream listener. See the Add a Webhook to Spinnaker section.
Additionally, Spinnaker is capable of handling cron-based triggers and detect changes in Jenkins builds and Docker images. This functionality will be documented at a later time.
See also hal config notifications
.
Notification configurations are in echo.yml and settings-local.js. For changes to echo.yml, create echo-local.yml and put your changes in there. You can customize settings-local.js directly.
Where to put echo-local.yml and settings.js
If you use Halyard to configure Spinnaker, put echo-local.yml ~/.hal/{deployment}/profiles/
.
For settings-local.js, follow the Custom Profile for Deck reference and place it in the following location ~/.hal/{deployment}/profiles/settings-local.js
.
If you don’t use Halyard, put echo-local.yml in the same place as the current echo.yml, in /opt/spinnaker/config
, and put settings-local.js in /opt/deck/html/
.
Spinnaker baseURL
You need to set the spinnaker.baseUrl
configuration value which is used by spinnaker templates. This should point back to the url for your spinnaker’s UI ( deck ) instance. This url is used in notifications to link back to your spinnaker instance.
Email in spinnaker is provided by Spring Boot Mailstarter.
The settings for some popular email providers are listed below:
Email Provider | SMTP username | SMTP password | SMTP server address | SMTP port (TLS) | SMTP port (SSL) | SMTP TLS/SSL required |
---|---|---|---|---|---|---|
Gsuite/Gmail | Your email address | Your email password | smtp.gmail.com | 587 | 465 | yes |
Yahoo | Your email address | Your email password | smtp.mail.yahoo.com | 587 | 465 | yes |
Hotmail/live | Your email address | Your email password | smtp.live.com | 587 | - | yes |
Outlook | Your email address | Your email password | smtp-mail.outlook.com | 587 | 25 | yes |
The following is an example of using hotmail to send notifications.
in echo.yml
in settings-local.js (deck)
Microsoft Teams
To enable Microsoft Teams support, add the following statement to the echo-local.yml
file:
Spinnaker supports sending notifications to Microsoft Teams using Incoming Webhooks.
To create a custom incoming webhook in Teams, follow the instructions provided here: Add an incoming webhook to a Teams channel
When configuring a Microsoft Teams notification, enter the full incoming webhook URL in the Teams Webhook URL
text box.
Slack
For slack, you need to create a custom botuser,then get the access token associated with that new bot user. Then…
Note: your users will need to invite the slack bot to private rooms that want to be notified.
Twilio
For Twilio, you need to add your account credentials. Then…
Using notifications
Once notifications have been configured, you can use them to send changes in pipelines and in the manual judgment stage in Spinnaker.
To set up an application-wide notification, go to Application -> Config -> Notifications,
Click on ‘Add Notification’
Enter your notification details.
You can also set Notifications at the Pipeline level ( under configuration ) and at the stage level ( by clicking on the [ ] Send Notifications for this stage checkbox.
Customizing notifications
Spinnaker will send a standard message based on the event that triggered the notification, indicating the stage (if applicable), the pipeline, the application, and the status of the event. It will also include a link to the pipeline.
For stage-level notifications, you can override the message by editing the JSON of the stage, adding a customBody
field (for email) or a customMessage
field (for Slack). If you are customizing an email notification, you can use Markdown or HTML to customize the format of the email. If you are using Slack, you can use a more limited range of formatting.
Spinnaker Slacks
For email messages, you can customize the subject by adding a customSubject
field.
All standard SpEL expressions will be evaluated prior to sending the notifications, and can be used in the custom notification fields.
There are two special variables available when adding a custom message or body: executionId
(the ID of the execution) and link
(a fully-formed URL for the pipeline or stage that triggered the notification). To use either of these fields, just wrap them in two curly brackets, e.g. {{link}}
.
An example of a custom email notification:
A custom Slack message:
Note: the custom fields will apply to all notifications within a stage. If you have different notifications for different events (e.g. a Slack message when the stage starts and when it completes), the custom fields will be applied to both messages.
Instead of listening for events from Github like in the Docker and Jenkins case, direct triggering from git requires a webhook endpoint to be set up in the corresponding VCS.
Github
Using Github as a Trigger
Go to your project’s Webhooks page, for example https://github.com/spinnaker/igor/settings/hooks
Click “Add webhook”
enter http://[spinnakerapi]/webhooks/git/github
in the Payload URL, wherespinnakerapi
is the location of your gate installation.
select “Just the push event”
make it active
Click “Add Webhook” button
Stash
Go to settings / hooks for your repository
Add a Post Receive webhook
Add the following URL: http://[gate url]/webhooks/git/stash
, where gate url
is the url to your spinnaker api.
You are now ready to receive events from this repository.
Spinnaker Slack Bar
BitBucket Cloud
Go to settings / webhooks for your repository
Click ‘Add webhook’
Add a ‘Repository Push’ or ‘Pull Request Merged’ webhook
Add the following URL: http://[gate url]/webhooks/git/bitbucket
, wheregate url
is the url to your spinnaker api.
You are now ready to receive events from this repository.
Add Git Trigger in Pipeline:
Go to Pipeline > Configuration
Select Trigger Type to be Git
Set Repository Type to be github, stash, or bitbucket
Enter your Repository organization / user
Enter your Repository name
Save your pipeline
Notes
You can access the hash of the build via expression ${trigger.hash}
The echo-restmodule in spinnaker allows you to set downstream listeners keeping track ofSpinnaker events.
Whenever Spinnaker receives an event from Orca, igor, or echo, it will forward these events to the webhooks registered.
A useful pattern is to have an intermediate service that will filter and convert events you care about into the format you expect.
Configuration in echo.yml
This will post every event to listener and listener2
Wrapping
Spinnaker Slack Login
If your endpoint expects events of the form
you can wrap the event via this configuration:
The flatten setting will simply make the json in content and details ( see below ) into a json String.
Here is an example event:
Events have details, which will always be the same.
Spinnaker Slack Bot
details.type
The type of the event will outline where the event is coming from:
- orca:[task type]:[status] - where task type is either ‘pipeline’, ‘stage’ or ‘task’ and status is ‘starting’, ‘complete’, ‘failed’
- build - from igor Jenkins events
- docker - from igor Docker events
- git - from git web triggers
details.application
The application involved in the execution, this will only exist for orca: type events.
Spinnaker Slack Notifications
content.execution
Spinnaker Slacker
For orca type events, this is the current execution that has the entire pipeline execution.