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

SPIKE | Automatic deployment from main to staging #9215

Closed
cdanfon opened this issue Aug 10, 2022 · 14 comments
Closed

SPIKE | Automatic deployment from main to staging #9215

cdanfon opened this issue Aug 10, 2022 · 14 comments
Assignees
Labels
devops engineering maintain Maintain digital systems

Comments

@cdanfon
Copy link

cdanfon commented Aug 10, 2022

This spike is to investigate options for automatic deployments from main to staging.

These are a few initial thoughts/questions:

  • What problem/pain point are we trying to solve?
  • What are the technical options?
  • What things do we have to consider around internal stakeholders?
  • How does the workflow look like?

[Time box to 2 hours]

@tbrlpld
Copy link
Collaborator

tbrlpld commented Oct 14, 2022

@cdanfon @mtdenton @danielfmiranda @fessehaye

I have been looking into this now for 2h and here are my notes:

  • What problem/pain point are we trying to solve?
    • Current process:
      • A feature or bug is developed on a dedicated branch. The work receives code review. Once the work is approved and passes all tests on CI, it is merged into the main branch.
      • After the merge to main a developer needs to check that CI on main still passes (maybe we are missing merge migrations etc.)?
      • Once CI passes on main the developer needs to pull the latest changes from GitHub to their local machine.
      • Once the developer has the latest changes on their machine, they can push the changes to staging.
    • Pain points:
      • We often have to wait for CI to pass twice, first on the feature branch before the merge and then on main. The CI on the feature branch is needed because often the branch needs to be updated before the merge which triggers CI. Each CI run takes like 10-15min to pass.
      • Did we check that the merged result on main passes This needs to be checked manually. I could accidentally fetch and deploy without waiting for CI to pass.
      • Did something else get merged into main between checking CI to pass and pulling the changes locally. This could lead to accidentally pushing unknown changes.
      • The manual pushing could deploy a wrong branch or wrong changes on accident. The local branch is not protected and could differ from what other devs have or be broken.
      • We sometimes forget to deploy our changes to staging right after merging. This leads to a single deployment releasing multiple possibly unrelated changes to staging.
      • If merged work is not deployed to staging right after it is merged and CI passes we are unnecessarily delaying QA, which delays deliver to stakeholders / users.
  • What are the technical options?
  • What things do we have to consider around internal stakeholders?
    • Activating the Heroku-Github integration goes against the security teams recommendations.
    • Moving the repositories to a new GitHub organization will require DevOps work. It has been done for the donate stack (https://github.com/MozillaFoundation/donate-wagtail), but I am not sure about the complexity and what a possible timeline could look like.
    • GitHub Action to deploy to Heroku with Git should be pretty simple to setup. It’s only a few commands, so we could be able to do this quite independently.
    • Using GitHub Actions for deployment would allow us to create some custom logic according to our internal workflows.
    • Design is used to reviewing PR on review apps and not staging. I might be more complex to setup review apps with GitHub Actions. Or, Design could review on staging?
  • How does the workflow look like?
    • Review the above options and discuss.
    • Get feedback from other stakeholders (Design, DevOps, SecOps).
    • Decide which path we want to take:
      • Integrations path: Move repositories to a new organization to enable the Heroku-GitHub integration.
      • Actions path: Create custom GitHub Actions workflows for deployment to staging (and maybe production)
    • Implement necessary changes.

@cdanfon
Copy link
Author

cdanfon commented Oct 17, 2022

Hi @tbrlpld Thanks for doing this, you've done great work breaking everything down so that it's pretty easy to understand.

@mtdenton Feels like the next action is for the engineering team to review the options and decide which one to go for. Are you OK to organise a meeting for this with Jen, Simon, Daniel and Tibor?

@mtdenton
Copy link
Contributor

Agreed, looking to have discussions surrounding this sometime after PNI launch.

@fessehaye
Copy link
Contributor

#9221 Just want to document that I attempted some solution to this around august.

@tbrlpld
Copy link
Collaborator

tbrlpld commented Oct 21, 2022

@fessehaye What was the result of your attempt? Was there something blocking you from getting further with it?

I could not finish my attempt because I can not set secrets on the repo. See #9494

@tbrlpld
Copy link
Collaborator

tbrlpld commented Oct 31, 2022

It appears no one is actively working on this. Moving this out of the sprint and back into sprint ready.

@tbrlpld
Copy link
Collaborator

tbrlpld commented Nov 11, 2022

@mtdenton Just wanted to raise awareness of this one, now that the PNI integration branch has been merged.

@tbrlpld tbrlpld self-assigned this Nov 17, 2022
@tbrlpld
Copy link
Collaborator

tbrlpld commented Nov 17, 2022

Pulling this into the sprint because I have some time after finishing my tickets and this will make all future work less painful.

@tbrlpld
Copy link
Collaborator

tbrlpld commented Nov 17, 2022

Since we are not going to have DevOps support for a while, we can go with the custom GitHub action for now. I had already explored what that could look like in #9494.

I will push that further to make it fully functioning.

If we want to switch the approach in the future, switch to a different org and fully activate the Heroku-Github integration we can do that later on. Creating the custom Action is not going to block that. So this decision is easily reversible.

@tbrlpld
Copy link
Collaborator

tbrlpld commented Nov 17, 2022

#9494 is now cleaned up and ready for review.

@tbrlpld
Copy link
Collaborator

tbrlpld commented Nov 21, 2022

@fessehaye @danielfmiranda @mmmavis Just tagging you all for review of PR #9494

@tbrlpld
Copy link
Collaborator

tbrlpld commented Nov 22, 2022

@tbrlpld
Copy link
Collaborator

tbrlpld commented Nov 23, 2022

This is still not working 😓

This was referenced Dec 1, 2022
tbrlpld added a commit that referenced this issue Dec 2, 2022
@tbrlpld
Copy link
Collaborator

tbrlpld commented Dec 2, 2022

@tbrlpld tbrlpld closed this as completed Dec 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
devops engineering maintain Maintain digital systems
Projects
None yet
Development

No branches or pull requests

7 participants