Skip to content

Draft a deployment notifier that posts on PR pre-prod status

Warren Gifford requested to merge devx/deployment-status into main

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.

  1. 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.
  2. It gets the list of commits that separates that commit from the one currently deployed on the staging.
  3. It posts on each associated PR a messages.
    • Skipped for now.
  4. 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 on deploy-sourcegraph-cloud in a branch
  • Run with real Slack and GitHub comments on small subset of commits.

Merge request reports

Loading