|
1 |
| -These documents have moved: https://github.com/dotnet/source-build/tree/release/3.1/Documentation/planning/arcade-powered-source-build |
| 1 | +> For the arcade-powered source-build status doc, see [implementation-plan.md](implementation-plan.md). |
| 2 | +
|
| 3 | +# Arcade-powered source-build |
| 4 | + |
| 5 | +Source-build existing as a process outside the Microsoft build impedes efforts |
| 6 | +to maintain the source-buildability of .NET Core. Integration into the normal |
| 7 | +build process is driven by two major goals: |
| 8 | + |
| 9 | +1. When the .NET Core SDK **official build** completes, its artifacts include |
| 10 | + validated, ship-ready source-build outputs, in addition to the Microsoft |
| 11 | + build outputs. |
| 12 | + |
| 13 | + * **Official builds** produce the signed bits released by Microsoft, running |
| 14 | + on a daily or per-commit basis depending on repo and point in time. |
| 15 | + |
| 16 | + * This has two core benefits over the current situation: we know immediately |
| 17 | + whether an SDK can be source-built cleanly, and the status is as visible as |
| 18 | + an SDK build failure. |
| 19 | + |
| 20 | + * Breaks in source-build can be detected and fixed immediately by repo |
| 21 | + owners, just as any other build failure, rather than fixed by source-build |
| 22 | + maintainers weeks to months after the fact using patches. |
| 23 | + |
| 24 | + * Microsoft build process owners don't need to reject late build respins |
| 25 | + based on manual post-build source-build efforts being projected to not |
| 26 | + complete in time for release dates. |
| 27 | + |
| 28 | + * Rebuilding the SDK close to a release day doesn't cause setbacks to |
| 29 | + source-build maintainers by throwing away manual build uptake work. |
| 30 | + |
| 31 | + * This eliminates the delay between Microsoft build completion and |
| 32 | + source-build tarball availability, as long as we treat a source-build |
| 33 | + failure as seriously as a Microsoft build failure. |
| 34 | + |
| 35 | +2. Every repo involved in source-build validates source-buildability in its **PR |
| 36 | + validation** build. |
| 37 | + |
| 38 | + * **PR validation** builds run on each pull request submitted to a |
| 39 | + repository, and is typically required to succeed to merge. There are also |
| 40 | + **rolling builds** that run lower-priority and slower tests after each |
| 41 | + merge. |
| 42 | + |
| 43 | + * This allows developers and release owners to understand the source-build |
| 44 | + impact of changes, reducing the frequency the source-build servicing team |
| 45 | + has to root-cause and patch over problems. |
| 46 | + |
| 47 | + * Gives us a place to add additional checks in the future, such as |
| 48 | + [nongranular servicing readiness](../nongranular-servicing-readiness/). |
| 49 | + |
| 50 | +This doc is about where we can start, what incremental progress would look like, |
| 51 | +and the vision. |
| 52 | + |
| 53 | +## Starting point: official build |
| 54 | + |
| 55 | +The output of source-build is a set of tarballs that can be used to build the |
| 56 | +.NET Core SDK from source. We can move the current behavior of source-build to |
| 57 | +the dotnet/installer official build. That is, dotnet/installer clones all |
| 58 | +constituent repos, applies patches, builds each repo using customized build |
| 59 | +commands, and produces the source-build tarballs as artifacts. |
| 60 | + |
| 61 | +This immediately makes the dotnet/source-build repo unnecessary for 5.0: it only |
| 62 | +held the source-build orchestration behavior. |
| 63 | + |
| 64 | +The migration work will be done in a new dev branch. It's expected that the dev |
| 65 | +branch will trail significantly behind the active 5.0 working branch: due to |
| 66 | +churn with 5.0 auto-updates and the full source-build being way too slow to put |
| 67 | +as a PR validation step in dotnet/installer, source-build would probably always |
| 68 | +fail if we tried to apply it to the mainline 5.0 branch. |
| 69 | + |
| 70 | +Putting source-build infrastructure into dotnet/installer doesn't directly |
| 71 | +accomplish any of our goals. However, it gives us a testbed for infrastructure |
| 72 | +that we need to move to dotnet/arcade, so we can be reasonably sure it will work |
| 73 | +when we roll it out to each repository. Eventually, the build performance will |
| 74 | +improve enough that source-build *can* run in PR validation. At that point, the |
| 75 | +dev branch can be merged and our goals will be accomplished. |
| 76 | + |
| 77 | +For more info, see [source-build-in-pipeline.md]. |
| 78 | + |
| 79 | +## Starting point: PR validation |
| 80 | + |
| 81 | +We can start here by adding extra jobs that run the standard source-build |
| 82 | +command and arguments. This is a simple step to confirm the build isn't |
| 83 | +fundamentally broken. |
| 84 | + |
| 85 | +This needs more work to meet our goals for many reasons: |
| 86 | + |
| 87 | +* Prebuilt dependency usage isn't tracked, because all dependencies are |
| 88 | + downloaded as non-source-built prebuilts. |
| 89 | +* Source-build behavior may not work with source-built upstreams. |
| 90 | +* The artifacts built by the repo may not work downstream. |
| 91 | +* Advanced build flows aren't checked, such as source-build bootstrap or using |
| 92 | + an N-1 SDK. |
| 93 | + |
| 94 | +For more info, see [source-build-in-pipeline.md]. |
| 95 | + |
| 96 | +Related work, but not necessary to meet our goals: |
| 97 | + |
| 98 | +* Unit tests are typically disabled in source-build, because test infrastructure |
| 99 | + isn't built from source. We should run tests on the source-build product to |
| 100 | + catch bugs. However, this isn't necessary to meet the maintainability goals of |
| 101 | + this plan. |
| 102 | + |
| 103 | +## Incremental progress |
| 104 | + |
| 105 | +### The performance gap |
| 106 | +We need to avoid building all constituent repos in the dotnet/installer build. |
| 107 | +To do this, each repo needs to produce intermediate source-built artifacts |
| 108 | +during its official build, to be consumed by downstream repos. On the other end, |
| 109 | +source-build needs to support restoring from an intermediate artifact. |
| 110 | + |
| 111 | +To make incremental progress, we should pick an upstream of dotnet/installer, |
| 112 | +and add source-build functionality that produces source-built intermediates. |
| 113 | +dotnet/installer should consume them. We should choose a leaf in the |
| 114 | +source-build dependency graph, dotnet/source-build-reference-packages (SBRP). |
| 115 | +When dotnet/installer looks at the build graph to determine which repos to |
| 116 | +build, instead of building SBRP, it should restore the SBRP intermediate |
| 117 | +artifact. Once we have this flow working, the functionality should be integrated |
| 118 | +into Arcade SDK for easy onboarding. |
| 119 | + |
| 120 | +Then, working from the bottom (leaves) upward (towards dotnet/installer), more |
| 121 | +repos should consume and produce source-built intermediates in their official |
| 122 | +builds. When this completes, each repo only needs to build itself. See |
| 123 | +[incremental-official.md] for more details about this process. |
| 124 | + |
| 125 | +It is possible to instead only implement official source-build in a handful of |
| 126 | +repos. This segments the build into chunks, which must be coherent. This idea is |
| 127 | +discussed in [incremental-official-chunked.md], and is not recommended. |
| 128 | + |
| 129 | +> Note: some constituent repos aren't maintained by Microsoft, so it isn't |
| 130 | +> feasible to add them directly to this flow. We could fork them and set up a |
| 131 | +> build just for source-build intermediates. If a repo builds quickly, however, |
| 132 | +> it might be better to simply rebuild it whenever the outputs are needed. |
| 133 | +
|
| 134 | +### Getting into Arcade |
| 135 | +The initial plan to run source-build in dotnet/installer doesn't assume any |
| 136 | +changes to Arcade: this should be possible due to the extension points that |
| 137 | +already exist in the Arcade SDK. Once we have that, it will be clearer what |
| 138 | +logic is missing, and how to add it. This allows us to migrate source-build |
| 139 | +logic incrementally and in parallel with other work. |
| 140 | + |
| 141 | +For more info, see [in-arcade.md]. |
| 142 | + |
| 143 | +### The speculative SDK |
| 144 | +It's difficult to validate that a PR won't break downstream repos. This problem |
| 145 | +is shared by source-build and the Microsoft build. "Speculative builds" have |
| 146 | +been proposed to try to help with this, but would be very difficult to implement |
| 147 | +in the Microsoft build. It may be more reasonable in the context of |
| 148 | +source-build: all builds happen on a single machine, so the problem is focused |
| 149 | +on figuring out a build graph rather than organizing dozens of machines in a |
| 150 | +build lab and flowing bits across a network. |
| 151 | + |
| 152 | +This is also necessary in source-build to validate several distro maintenance |
| 153 | +scenarios: by making a PR, is it still possible to run a bootstrap build of the |
| 154 | +.NET Core SDK? Can .NET Core SDK version N be built using SDK N-1? |
| 155 | + |
| 156 | +This can be developed in parallel to other efforts. See [speculative-build.md] |
| 157 | +for more info about speculative builds. |
| 158 | + |
| 159 | +## End result |
| 160 | + |
| 161 | +When all of this is working, the official Microsoft build of the .NET Core SDK |
| 162 | +also produces tarballs that distro maintainers can use to build it from source. |
| 163 | +Contributors in each repo use checks in PR validation to verify each change is |
| 164 | +compatible with source-build requirements, and if validation runs into a |
| 165 | +problem, they are able to reproduce the build locally using an Arcade build |
| 166 | +command. |
| 167 | + |
| 168 | +--- |
| 169 | + |
| 170 | +## Q&A |
| 171 | + |
| 172 | +### Q: How do we patch without an orchestration-focused repo? |
| 173 | +A: We shouldn't! But if we have to, use a forked branch. See |
| 174 | +[patching.md](patching.md). |
| 175 | + |
| 176 | + |
| 177 | +[in-arcade.md]: in-arcade.md |
| 178 | +[incremental-official-chunked.md]: incremental-official-chunked.md |
| 179 | +[incremental-official.md]: incremental-official.md |
| 180 | +[source-build-in-pipeline.md]: source-build-in-pipeline.md |
| 181 | +[speculative-build.md]: speculative-build.md |
| 182 | + |
| 183 | +--- |
| 184 | + |
| 185 | +## Revisions: |
| 186 | + |
| 187 | +**2020-07-15** dagood |
| 188 | +Removed the plan to test every added intermediate nupkg all the way downstream |
| 189 | +in dotnet/installer. Looking at it after some hands-on work has been done, we |
| 190 | +don't think this end-to-end integration test is actually feasible. Not running |
| 191 | +these tests creates some uncertainty, but it seems acceptable. We will likely |
| 192 | +end up with a backlog of unknown issues to work through once we start building a |
| 193 | +tarball in dotnet/installer. They *may* have been avoided with testing. We don't |
| 194 | +expect this will be disruptive enough to make it worth trying to more |
| 195 | +exhaustively find some way to get end-to-end testing feasible. |
0 commit comments