Spacelift Webhook Receiver is a service for recieving Spacelift webhook/audit events and notifying channels/users in Slack.
Subscriptions are set up per-stack using slack:#channel
labels (more details below).
SWR runs in AWS Lambda and is written in Typescript.
Label examples:
slack:#infra
slack:#infra:finished,failure,unconfirmed
slack:user.name:planning
Labels are colon :
delimited.
slack
.#foo
), username (user.name
), channel ID (C12345XYZ
), or user ID (U12345XYZ
). (If you want to specify multiple targets, add one label for each.)failure
. Comma-separate multiple states.There's no authoritative list of states in Spacelift's docs. The closest you'll find is the page on run states. Here's an incomplete list for your convenience: queued
, preparing
, initializing
, planning
, unconfirmed
, confirmed
, applying
, finished
, failure
, destroying
, performing
.
At the moment, deploying this service is quite manual. The high-level process is:
chat:write.public
(message public channels)chat:write
(message private channels the bot is invited to)im:write
(DM users)users:read
(send messages to user.names)cd app
npm ci
npm run-script build
You'll end up with dist/dist.zip
which contains the Lambda handler.
There is a Terraform module in infra/
which can deploy the minimal required AWS resources. See the example usage in infra/example/
.
Once the service is deployed, you need to add a webhook in Spacelift. There are two ways to do this:
There's no difference in functionality between these approaches. Which to use depends on your preference whether the receiver is available by default for all stacks, or installed on a per-stack basis.