Add Codespaces for source build investigations (#15285)

This commit is contained in:
Přemek Vysoký 2023-01-19 09:57:51 +01:00 committed by GitHub
parent 1670d4fa6e
commit f71904833c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 98 additions and 4 deletions

View 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.

View 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"
}

View 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