|
| 1 | +# 12. Couple the Enterprise and OSS development process |
| 2 | + |
| 3 | +Date: 2022-08-12 |
| 4 | + |
| 5 | +## Status |
| 6 | + |
| 7 | +Proposed |
| 8 | + |
| 9 | +## Context |
| 10 | + |
| 11 | +Weave Gitops OSS and Weave Gitops Enterprise are in many ways set up |
| 12 | +as though they are two independent projects - Enterprise uses stable |
| 13 | +releases of OSS, much like it uses stable releases of Flux or Cobra. |
| 14 | + |
| 15 | +However, that doesn't reflect the reality. The reality is that they |
| 16 | +are two tightly coupled projects, in several ways. For one thing, |
| 17 | +there is a lot of library code in OSS that Enterprise uses - and maybe |
| 18 | +there's scope for this to grow. For another thing, there's an |
| 19 | +increasing commercial desire to be able to move capabilities between |
| 20 | +the two codebases cheaply. |
| 21 | + |
| 22 | +This disconnect between the architecture and engineering reality |
| 23 | +wastes time and makes both stakeholders and engineers frustrated. It's |
| 24 | +difficult to quantify the exact amount of time wasted, so this instead |
| 25 | +describes two scenarios that both are common, and are healthy in a |
| 26 | +product before version 1.0. |
| 27 | + |
| 28 | +The first scenario is an Enterprise developer who spots a JS |
| 29 | +component in OSS that just need a one line fix to be perfect for the |
| 30 | +developer's current ticket. They are faced with two choices: |
| 31 | + |
| 32 | +* Either they have to make a pull request, then wait for the next time |
| 33 | + OSS makes a release, and then finish their ticket. |
| 34 | +* Or, they have to copy-paste the whole component into a "vendored" |
| 35 | + one. |
| 36 | + |
| 37 | +The other scenario is a developer working on an OSS feature that uses |
| 38 | +shared code with Enterprise wants to make an API change. They have |
| 39 | +three options: |
| 40 | + |
| 41 | + * They can spend time making it backwards compatible so Enterprise doesn't |
| 42 | + need to change, leaving 2 implementations of the feature inside OSS |
| 43 | + * They can try to remember to submit a pull request to Enterprise |
| 44 | + the next time OSS makes a release |
| 45 | + * They can just leave it for the Enterprise developers to figure out |
| 46 | + and fix. |
| 47 | + |
| 48 | +In both cases, the developer is faced with the choice to accrue tech |
| 49 | +debt at a frightening rate, or slow down the Enterprise process. |
| 50 | + |
| 51 | +## Decision |
| 52 | + |
| 53 | +We will accept the fact that the two code bases are so tightly |
| 54 | +coupled, and embrace it. |
| 55 | + |
| 56 | +The enterprise `main` branch will start tracking the OSS `main` |
| 57 | +branch, in both javascript and go. This will be accomplished with a |
| 58 | +github action that creates or updates a PR in Enterprise with the |
| 59 | +latest OSS main, which kicks off Enterprise's CI, and if it fails the |
| 60 | +developer who changed OSS will be notified and be able to fix the |
| 61 | +breakage directly, while the context is still in their brain. |
| 62 | + |
| 63 | +This tries to illustrate the proposed flow when OSS Oscar works on a |
| 64 | +new feature that changes APIs that Enterprise is using - when Enterprise |
| 65 | +Enya next wants to upgrade OSS, Oscar has already pushed an API migration. |
| 66 | +```mermaid |
| 67 | +sequenceDiagram |
| 68 | + participant Oscar |
| 69 | + participant OSS as Gitops OSS |
| 70 | + participant Enterprise as Gitops Enterprise |
| 71 | + participant Enya |
| 72 | + Oscar->>OSS: Make PR with new feature |
| 73 | + OSS->>Oscar: Success ✅ |
| 74 | + Oscar->>OSS: Merge |
| 75 | + OSS->>Enterprise: Open PR to bump OSS |
| 76 | + Enterprise->>Oscar: Build failed ⛔ |
| 77 | + Oscar->>Enterprise: Use new feature |
| 78 | + Enterprise->>Oscar: Success ✅ |
| 79 | + Enya->>Enterprise: Approve ✅ |
| 80 | + Oscar->>Enterprise: Merge |
| 81 | +``` |
| 82 | + |
| 83 | +This means that OSS's release process needs to similarly kick off an |
| 84 | +Enterprise release process - when OSS forks a branch to release, that |
| 85 | +triggers another action that does the same for Enterprise. When OSS |
| 86 | +decides to approve the release, the Enterprise PR is updated with the |
| 87 | +stable tags for OSS. |
| 88 | + |
| 89 | +This tries to illustrate the proposed release process - as it is |
| 90 | +Enterprise that depends on OSS, Oscar must launch the process, but as |
| 91 | +soon as it's begun Enya is able to start testing the release in |
| 92 | +Enterprise. When OSS has finished publishing its release, Enya is able |
| 93 | +to just release the PR that OSS generated automatically. |
| 94 | +```mermaid |
| 95 | +sequenceDiagram |
| 96 | + participant Oscar |
| 97 | + participant OSS as Gitops OSS |
| 98 | + participant Enterprise as Gitops Enterprise |
| 99 | + participant Enya |
| 100 | + Oscar->>OSS: Kick off release process |
| 101 | + OSS->>OSS: Opens PR with updated versions |
| 102 | + OSS->>Enterprise: Make release test PR to update versions |
| 103 | + Oscar->>OSS: Approve ✅ |
| 104 | + Enya->>OSS: Approve ✅ |
| 105 | + OSS->>OSS: Merge PR and publish release |
| 106 | + OSS->>Enterprise: Make a PR to update OSS, make release |
| 107 | + Enya->>Enterprise: Make further changes |
| 108 | + Enya->>Enterprise: Approve ✅ |
| 109 | + Enterprise->>Enterprise: Release & merge |
| 110 | +``` |
| 111 | + |
| 112 | +In both cases, the automation doesn't go as far as to change |
| 113 | +Enterprise - it will merely make pull requests for human review. |
| 114 | + |
| 115 | +## Consequences |
| 116 | + |
| 117 | +This is intended to be a pragmatic decision that can be implemented |
| 118 | +very quickly, that helps unblock our developers today. It recognizes |
| 119 | +that the boundary between OSS and Enterprise isn't technical but |
| 120 | +rather driven by commercial strategy, and as a result isn't sitting |
| 121 | +right for the engineers working in it every day. It's very easy to |
| 122 | +come up with multiple proposals that are better, however those |
| 123 | +proposals would take more work, time, and decisions - this proposal |
| 124 | +can be implemented now, and would let most developers continue working |
| 125 | +the way they do today, just faster. |
| 126 | + |
| 127 | +The main upside is that changes in OSS will be available to use in |
| 128 | +Enterprise in about 15 minutes, compared to weeks today. This is the |
| 129 | +kind of improvement that's so big that it's not just about "closing |
| 130 | +tickets faster" - it would get rid of entire classes of problems |
| 131 | +and sources of frustration to do with migrations and API stability. If |
| 132 | +a developer wants to change an API that's used in both, they can fix |
| 133 | +both and have them merged before lunch. |
| 134 | + |
| 135 | +As a result, this would bring some of the benefits we could get from |
| 136 | +setting up a monorepo for both OSS and Enterprise, but this could be |
| 137 | +done very quickly, with very little changes to existing workflows. |
| 138 | + |
| 139 | +The biggest challenge is that it would couple releases between OSS and |
| 140 | +Enterprise. Enterprise's main branch today can always be released |
| 141 | +using a stable OSS release - with this change, Enterprise would have |
| 142 | +to choose between releasing with an unstable OSS version, roll back or |
| 143 | +backport changes so they work with the last stable OSS release, or ask |
| 144 | +OSS to make a stable release. However, it's worth pointing out that |
| 145 | +this won't prevent Enterprise from releasing a customer-specific |
| 146 | +pre-release - just that the cost of doing that would be slightly |
| 147 | +higher in that it needs to verify both OSS and Enterprise |
| 148 | +functionality. |
| 149 | + |
| 150 | +However, these release challenges are a new iteration of an old pain |
| 151 | +point - both Enterprise and OSS are lacking process for longer-lived |
| 152 | +stable branches that are separate from the main feature development |
| 153 | +branches so any release includes anything that has landed in main. |
| 154 | +It is assumed that both projects will need to solve that. Discussions |
| 155 | +about how to do that are already happening, but are out of scope or |
| 156 | +this ADR. Until then, both OSS and Enterprise should agree to try to |
| 157 | +do a stable release every 2 weeks, whether there are new features or |
| 158 | +not, as long as there's no blocking bugs. This synchronization only |
| 159 | +happens between the release management function in the respective |
| 160 | +project, instead of all developers being subject to this |
| 161 | +synchronization overhead. |
0 commit comments