Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CEP] Migration alerts before deploy #27838

Closed
esoergel opened this issue Jun 17, 2020 · 3 comments
Closed

[CEP] Migration alerts before deploy #27838

esoergel opened this issue Jun 17, 2020 · 3 comments
Labels
CEP CommCare Enhancement Proposal

Comments

@esoergel
Copy link
Contributor

Abstract

The aim of this work is to better communicate to deployers what changes are about to be deployed.

We currently use tags on pull requests to flag pull requests that have, for instance, a reindex or migration. This information should be presented to deployers at the very beginning of the deploy process, as part of the “are you sure you want to deploy?” message.

Motivation

Deployers are usually unaware of what exactly they are deploying, particularly as 3rd parties are hosting their own instances, and as the Divisions at Dimagi operate independently. This is intended as a means for PR authors to communicate with deployers.

Specification

Current state

When deploys happen, we use git tags to label the commits that have been deployed to each environment. At the end of the deploy, we then generate a github URL which compares this deploy to the previous one. The deploy scripts then pass this information to a management command, record_deploy_success which emails it to admins, and creates a record of this deploy for later reference.

One glaring issue with this approach is that saving git tags requires write access to the repository, so this is fully off-limits for third-party environments, which deploy the Dimagi-controlled HQ repo. Another limitation is that information about deploys is only presented after the deploy is complete, so it can’t be used to warn of potential concerns or special considerations.

Desired changes

This can happen entirely inside commcare-cloud/fab/.

  • Add a function to get a list of PRs between last_commit_sha and deploy_ref.
  • Extract tag information for each of these pull requests
  • Render this list of pull requests to the console, displaying each PR's name, a link to the PR, and all its tags. If any of those PRs are tagged reindex/migration, add a message in red to the bottom along the lines of "Warning! You are about to deploy the following PR(s), which will trigger a reindex or migration. Click the link for additional context", and repeat those PRs.
  • Insert this message here.

Impact on users

None

Impact on hosting

Should reduce the communication gap between code authors and deployers.

Backwards compatibility

Backwards compatible

Release Timeline

Open questions and issues

@esoergel esoergel added the CEP CommCare Enhancement Proposal label Jun 17, 2020
@esoergel esoergel changed the title [CEP] Deploy History and Migration Alerts [CEP] Migration Alerts Jun 17, 2020
@millerdev
Copy link
Contributor

millerdev commented Jun 17, 2020

+1 I like it.

One glaring issue with this approach is that saving git tags requires write access to the repository, so this is fully off-limits for third-party environments...

Does this CEP address this issue? I don't see how the proposed changes affect it, but I agree that it is annoying (although seems irrelevant here). Maybe it needs a separate CEP?

Edit: I think that other CEP is #27839

@esoergel
Copy link
Contributor Author

@millerdev

Yeah, I initially thought we'd need to save a commit history in HQ and reference that in order to do the diff. I was like 3/4 of the way through writing this when I saw the fallback clause here - that we can just check against the current code in the repo, and that we already do that 🤦

I do still think saving the commit directly is a saner state for that stuff, but since it's not directly relevant to this CEP anymore, I spun that off separately.

@esoergel esoergel changed the title [CEP] Migration Alerts [CEP] Migration alerts before deploy Jun 29, 2020
@esoergel
Copy link
Contributor Author

implemented in the above PRs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CEP CommCare Enhancement Proposal
Projects
None yet
Development

No branches or pull requests

2 participants