Draft a deployment notifier that posts on PR pre-prod status
Created by: jhchabran
Fixes https://github.com/sourcegraph/sourcegraph/issues/31839
This introduces a deployment notifier, that will detect the changes being deployed, post GitHub comments and post a Slack summary.
As we're one step from turning this into something usable right now to notify production deployments, I went ahead and added specific code able to handle production deployments.
- It takes as an input a commit coming from the CI pipeline that triggers the preprod pipeline.2.
- A
sourcegraph.guess-commit
flag is provided in order to analyze the changes to detect which commit is going to be deployed, so we can use this on production deployment which are driven by Renovate.
- A
- It gets the list of commits that separates that commit from the one currently deployed on the staging.
- It posts on each associated PR a messages.
- Skipped for now.
- It posts a Slack message with a list of PR and pings their author.
See also https://github.com/sourcegraph/deploy-sourcegraph-cloud/pull/15859
@bobheadxi I think a safe way to start with this is to just use with Slack notifications for a few days, then to wire the GitHub comments if we see it working correctly. With the fact that some deployments are done sometime once in a day in the case of gitserver
, that would mean a lot of PR being commented on, so better be safe than sorry for posting 200 comments
A remaining minor question is how to ship the binary on the other sourcegraph/deploy-*
repo, but that shouldn't be a problem.
Test plan
-
Added unit tests with recorded payloads -
Run with -pretend
ondeploy-sourcegraph-cloud
in a branch - Run with real Slack and GitHub comments on small subset of commits.