Add Codespaces for source build investigations (#15285)
This commit is contained in:
parent
1670d4fa6e
commit
f71904833c
7 changed files with 98 additions and 4 deletions
27
.devcontainer/vmr-source-build/README.md
Normal file
27
.devcontainer/vmr-source-build/README.md
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
<!--
|
||||||
|
######## ######## ### ######## ######## ## ## #### ######
|
||||||
|
## ## ## ## ## ## ## ## ## ## ## ## ##
|
||||||
|
## ## ## ## ## ## ## ## ## ## ## ##
|
||||||
|
######## ###### ## ## ## ## ## ######### ## ######
|
||||||
|
## ## ## ######### ## ## ## ## ## ## ##
|
||||||
|
## ## ## ## ## ## ## ## ## ## ## ## ##
|
||||||
|
## ## ######## ## ## ######## ## ## ## #### ######
|
||||||
|
-->
|
||||||
|
|
||||||
|
This Codespace can help you debug the source build of .NET. In case you have run this from a
|
||||||
|
`dotnet/installer` PR branch, it will contain the VMR (`dotnet/dotnet`) checked out into
|
||||||
|
`/workspaces/dotnet` with the PR changes pulled into it. You can then attempt to source-build
|
||||||
|
the VMR which is what the VMR leg in the installer PR build doing. This build takes about 45
|
||||||
|
minutes and, after completion, produces an archived .NET SDK in `/workspaces/artifacts/x64/Release`.
|
||||||
|
|
||||||
|
To build the VMR, run following:
|
||||||
|
```bash
|
||||||
|
cd /workspaces/dotnet
|
||||||
|
unset RepositoryName
|
||||||
|
./build.sh --online
|
||||||
|
```
|
||||||
|
|
||||||
|
> Please note that, at this time, the build modifies some of the checked-in sources so it might
|
||||||
|
be preferential to rebuild the Codespace between attempts.
|
||||||
|
|
||||||
|
For more details, see the instructions at https://github.com/dotnet/dotnet.
|
24
.devcontainer/vmr-source-build/devcontainer.json
Normal file
24
.devcontainer/vmr-source-build/devcontainer.json
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
// Container suitable for investigating issues with source build
|
||||||
|
// Contains the VMR (dotnet/dotnet) with applied changes from the current PR
|
||||||
|
// The container supports source-building the SDK
|
||||||
|
{
|
||||||
|
"name": "VMR with PR changes",
|
||||||
|
"image": "mcr.microsoft.com/dotnet-buildtools/prereqs:fedora-36",
|
||||||
|
"hostRequirements": {
|
||||||
|
// A completely source built .NET is >64 GB with all the repos/artifacts
|
||||||
|
"storage": "128gb"
|
||||||
|
},
|
||||||
|
"customizations": {
|
||||||
|
"vscode": {
|
||||||
|
"extensions": [
|
||||||
|
"ms-dotnettools.csharp"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"codespaces": {
|
||||||
|
"openFiles": [
|
||||||
|
".devcontainer/vmr-source-build/README.md"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"onCreateCommand": "${containerWorkspaceFolder}/.devcontainer/vmr-source-build/init.sh"
|
||||||
|
}
|
35
.devcontainer/vmr-source-build/init.sh
Normal file
35
.devcontainer/vmr-source-build/init.sh
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -ex
|
||||||
|
|
||||||
|
source="${BASH_SOURCE[0]}"
|
||||||
|
script_root="$( cd -P "$( dirname "$source" )" && pwd )"
|
||||||
|
|
||||||
|
# TODO: Remove once we have a new version of the image
|
||||||
|
dnf -y install openssl1.1
|
||||||
|
|
||||||
|
installer_dir=$(realpath "$script_root/../..")
|
||||||
|
workspace_dir=$(realpath "$installer_dir/../")
|
||||||
|
tmp_dir=$(realpath "$workspace_dir/tmp")
|
||||||
|
vmr_dir=$(realpath "$workspace_dir/dotnet")
|
||||||
|
|
||||||
|
mkdir -p "$tmp_dir"
|
||||||
|
|
||||||
|
# Codespaces performs a shallow fetch only
|
||||||
|
git -C "$installer_dir" fetch --all --unshallow
|
||||||
|
|
||||||
|
# We will try to figure out, which branch is the current (PR) branch based off of
|
||||||
|
# We need this to figure out, which VMR branch to use
|
||||||
|
vmr_branch=$(git log --pretty=format:'%D' HEAD^ | grep 'origin/' | head -n1 | sed 's@origin/@@' | sed 's@,.*@@')
|
||||||
|
|
||||||
|
"$installer_dir/eng/vmr-sync.sh" \
|
||||||
|
--vmr "$vmr_dir" \
|
||||||
|
--tmp "$tmp_dir" \
|
||||||
|
--branch "$vmr_branch" \
|
||||||
|
--debug
|
||||||
|
|
||||||
|
# Run prep.sh
|
||||||
|
unset RepositoryName
|
||||||
|
pushd "$vmr_dir"
|
||||||
|
./prep.sh
|
||||||
|
popd
|
|
@ -66,6 +66,15 @@ The dependencies for building .NET from source can be found [here](https://githu
|
||||||
Clone the dotnet/dotnet repo and check out the tag for the desired release.
|
Clone the dotnet/dotnet repo and check out the tag for the desired release.
|
||||||
Then, follow the instructions in [dotnet/dotnet's README](https://github.com/dotnet/dotnet/blob/main/README.md#dev-instructions) to build .NET from source.
|
Then, follow the instructions in [dotnet/dotnet's README](https://github.com/dotnet/dotnet/blob/main/README.md#dev-instructions) to build .NET from source.
|
||||||
|
|
||||||
|
### Codespaces
|
||||||
|
|
||||||
|
It is also possible to utilize [GitHub Codespaces](https://github.com/features/codespaces) and build .NET from the `dotnet/dotnet` repository from source that way.
|
||||||
|
You can either create a Codespace in `dotnet/dotnet` directly or you can also make one from a PR branch in `dotnet/installer`. This will give you an environment with the VMR checked out and containing all of new changes from the PR.
|
||||||
|
This can be especially valuable for investigations of source-build failures during PRs.
|
||||||
|
|
||||||
|
To create a Codespace for a `dotnet/installer` PR, use the `vmr-source-build` devcontainer configuration (select this when "newing the Codespace with options" under the three-dots-menu).
|
||||||
|
Further instructions on how to build inside of the Codespace will be available upon launch.
|
||||||
|
|
||||||
## Building .NET 7.0 and .NET 6.0
|
## Building .NET 7.0 and .NET 6.0
|
||||||
|
|
||||||
1. Create a .NET source tarball.
|
1. Create a .NET source tarball.
|
||||||
|
|
|
@ -151,6 +151,7 @@ fi
|
||||||
if [[ ! -d "$vmr_dir" ]]; then
|
if [[ ! -d "$vmr_dir" ]]; then
|
||||||
highlight "Cloning 'dotnet/dotnet' into $vmr_dir.."
|
highlight "Cloning 'dotnet/dotnet' into $vmr_dir.."
|
||||||
git clone https://github.com/dotnet/dotnet "$vmr_dir"
|
git clone https://github.com/dotnet/dotnet "$vmr_dir"
|
||||||
|
git switch -c "$vmr_branch"
|
||||||
else
|
else
|
||||||
if ! git -C "$vmr_dir" diff --quiet; then
|
if ! git -C "$vmr_dir" diff --quiet; then
|
||||||
fail "There are changes in the working tree of $vmr_dir. Please commit or stash your changes"
|
fail "There are changes in the working tree of $vmr_dir. Please commit or stash your changes"
|
||||||
|
|
|
@ -9,8 +9,7 @@
|
||||||
"customizations": {
|
"customizations": {
|
||||||
"vscode": {
|
"vscode": {
|
||||||
"extensions": [
|
"extensions": [
|
||||||
"ms-dotnettools.csharp",
|
"ms-dotnettools.csharp"
|
||||||
"eamodio.gitlens"
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,8 +9,7 @@
|
||||||
"customizations": {
|
"customizations": {
|
||||||
"vscode": {
|
"vscode": {
|
||||||
"extensions": [
|
"extensions": [
|
||||||
"ms-dotnettools.csharp",
|
"ms-dotnettools.csharp"
|
||||||
"eamodio.gitlens"
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue