This Vapor project actually consists of two projects:
- The Stevenson framework, aimed to be reused so you can create your own bots interacting with Slack, GitHub, CircleCI and JIRA yourselves
- The Stevenson Babylon app, which is the instance of the Bot we use at Babylon, based on the Stevenson framework, and which provides us with commands we need
The bot instance of Stevenson we use at Babylon uses environment variables to instantiate and configure the various services (see README.md and configure.swift
).
The list of all those environment variables we use can be found in app.swift
(see extension Environment { … }
)
- Those environement variables need to be declared on the hosting service on which this bot will be deployed
- You will also need to declare these environment variables in your scheme (Edit Scheme > "Run" action > "Arguments" tab) if you want to run our bot instance locally in Xcode for debugging pruposes
The Stevenson instance used at Babylon, whose code can be found in the App/
directory, consist of 3 main core features
Allows us to use a slash command in our Slack to trigger CI workflows.
- Usage and supported commands are documented in our playbook here.
- The commands are implemented/defined in
SlackCommand+Fastlane.swift
and then handled inSlackService.swift
byfunc handle(command:on:)
.
Implementation consists of parsing the slack command parameters, then invoking CircleCIService.runlane
with the right arguments.
Our Slack is configured to send webhooks for those slash commands to the URL of our bot for it to process those requests – See main README.md for details.
- Usage documentation can be found here
- Implementation consists of a route implemented in
routes.swift
and invokingGitHubService.issueComment(on:ci:)
(inGitHubService+IssueComment.swift
).
The method parses the webhook request headers and the comment body, then callsCircleCIService.runLane
orCircleCIService.runPipeline
appropriately to trigger the right CI workflow.
Our GitHub repository is then configured with a webhook on comments, which sends the request to the URL of our bot so it can process it.
The CRP is a process specific to our company's SSDLC; it is documented in our Playbook repository: