Add VMR sync functionality into dotnet/dotnet's Codespaces (#15750)

This commit is contained in:
Přemek Vysoký 2023-03-13 14:44:42 +01:00 committed by GitHub
parent 359d6cd0db
commit d4db076b20
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 184 additions and 95 deletions

View file

@ -12,14 +12,14 @@ This Codespace can help you debug the source build of .NET. In case you have run
`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`.
minutes and, after completion, produces an archived .NET SDK located in
`/workspaces/dotnet/artifacts/x64/Release`.
## Build the SDK
To build the VMR, run following:
```bash
cd /workspaces/dotnet
unset RepositoryName
./build.sh --online
```
@ -37,22 +37,16 @@ When debugging the build, you have two options how to test your changes in this
You can make the changes directly to the local checkout of the VMR at `/workspaces/dotnet`. You
can then try to build the VMR and see if the change works for you.
### Pull changes into the local VMR
### Pull changes into the Codespace from your fork
You can also make a fix in the individual source repository (e.g. `dotnet/runtime`) and push the
fix into a branch (can be in your fork too). Once you have the commit pushed, you can pull this
version of the repository into the VMR locally.
fix into a branch; can be in your fork too. Once you have the commit pushed, you can pull this
version of the repository into the Codespace by running:
Let's consider you pushed a commit with SHA `abcdef` into your fork at `github.com/yourfork/runtime`.
You can now bring this version of runtime into the local VMR in this Codespace by running:
```bash
cd /workspaces/installer
./eng/vmr-sync.sh \
--vmr /workspaces/dotnet \
--tmp /workspaces/tmp \
--repository runtime:abcdef \
--remote runtime:https://github.com/yourfork/runtime
```
/workspaces/synchronize-vmr.sh \
--repository <repo>:<commit, tag or branch> \
--remote <repo>:<fork URI>
```
You can now proceed building the VMR in the Codespace using instructions above. You can repeat

View file

@ -10,6 +10,8 @@ workspace_dir=$(realpath "$installer_dir/../")
tmp_dir=$(realpath "$workspace_dir/tmp")
vmr_dir=$(realpath "$workspace_dir/dotnet")
cp "$installer_dir/.devcontainer/vmr-source-build/synchronize-vmr.sh" "$workspace_dir"
mkdir -p "$tmp_dir"
# Codespaces performs a shallow fetch only
@ -18,21 +20,16 @@ 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 -C "$installer_dir" log --pretty=format:'%D' HEAD^ \
| grep 'origin/' \
| head -n1 \
| grep 'origin/' \
| head -n1 \
| sed 's@origin/@@' \
| sed 's@,.*@@')
pushd "$installer_dir"
"./eng/vmr-sync.sh" \
--vmr "$vmr_dir" \
--tmp "$tmp_dir" \
--branch "$vmr_branch" \
--debug
popd
"$workspace_dir/synchronize-vmr.sh" \
--repository "installer:$(git -C "$installer_dir" rev-parse HEAD)" \
--recursive \
--branch "$vmr_branch" \
--remote "installer:$installer_dir" \
--debug
# Run prep.sh
unset RepositoryName
pushd "$vmr_dir"
./prep.sh
popd
(cd "$vmr_dir" && ./prep.sh)

View file

@ -0,0 +1,4 @@
#!/bin/bash
(cd /workspaces/installer \
&& ./eng/vmr-sync.sh --vmr /workspaces/dotnet --tmp /workspaces/tmp $*)