Sage-Bionetworks / sage-monorepo

Where OpenChallenges, Schematic, and other Sage open source apps are built
https://sage-bionetworks.github.io/sage-monorepo/
Apache License 2.0
23 stars 12 forks source link

[Story] Refactor CI/CD to support e2e and deployment to AWS #2435

Closed tschaffter closed 7 months ago

tschaffter commented 9 months ago

What product(s) is this story for?

Sage Monorepo

As a user, I want

No response

Description

We need to:

Other considerations:

References:

Acceptance criteria

TBA

Tasks

Anything else?

cc @andrewelamb

Have you linked this story to a GitHub Project?

tschaffter commented 9 months ago

About environments

Conclusion

The environments that OC should deploy are:

tschaffter commented 9 months ago

Branching strategies

Trunk Base Development Vs Feature Branching (Github Flow)

Feature Trunk Base Development Feature Branching (Github Flow)
Main branch Always deployable Not always deployable
Feature branches Short-lived, optional Long-lived, required
Merge frequency Frequent Infrequent
CI/CD emphasis Strong Weaker
Complexity Simpler More complex
Merge conflicts Less likely More likely

Forking Workflow

Gitlab Branches

Example workflow:

  1. developer creates your own branch ( Switch to master branch then pull all changes and finally create a feature branch
  2. developer staging your branch ( git add and commit changes )
  3. developer integrating his feature branch into environment branches
    • How is main updated?
  4. usually, CI/CD is used to deploy in developer, staging, tests, and production environment

References

tschaffter commented 9 months ago

Review Creating separate monorepo CI/CD pipelines with GitHub Actions

This is an article about creating separate CI/CD pipelines for microservices in a monorepo using GitHub Actions. It discusses the benefits of using microservices and why deploying them independently is important. It also explains how traditional monorepo CI/CD pipelines can’t handle individual deployments. The article then introduces a solution using GitHub Actions workflows to create separate CI/CD pipelines for each microservice in a monorepo. Finally, it provides an example project with instructions on how to run it.

About Metarepo:

Metarepos combine the convenience of a monorepo with the flexibility of separate code repositories. But still, having separate code repositories adds complexity, and it would be better if we could stick to the simpler monorepo for as long as possible.

tschaffter commented 9 months ago

Enable approval for workflow runs from forks in GitHub Actions

Current settings:

image

Google Bard:

Here's a guide on how to run e2e tests with GitHub Workflows in a forking workflow:

1. Create or Update a Workflow File:

2. Configure Actions for E2E Tests:

3. Run the E2E Tests:

4. Customize Actions for Forked Repositories:

5. Example Workflow File:

name: E2E Tests

on: [pull_request]

jobs:
  test:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-node@v3
        with:
          node-version: 16
      - run: npm install
      - run: npm test:e2e

Additional Considerations:

tschaffter commented 9 months ago

Enable workflows from forks to access secrets with labels

See https://stackoverflow.com/a/77007901

tschaffter commented 8 months ago

Added to Sprint 24.2

tschaffter commented 8 months ago

Added to Sprint 24.3

tschaffter commented 7 months ago

Conclusion

We have a general solution to run e2e tests as part of PRs that originate from forks.

The OC team and Platform are now teaming up to deploy OC to AWS in a scalable way. The Platform team will be responsible for deciding how to deploy OC to AWS.