-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add initial codespaces support for dotnet/runtime #59723
Conversation
Tagging subscribers to this area: @Anipik, @safern, @ViktorHofer Issue DetailsThese are the initial scripts to configure Codespaces in the dotnet/runtime repo. These settings allow for a successful
|
|
||
// Use 'postCreateCommand' to run commands after the container is created. | ||
"postCreateCommand": "bash -i ${containerWorkspaceFolder}/.devcontainer/scripts/postCreateCommand.sh", | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would a "postStartCommand" allow us to do something useful? If we could write a welcome message to the user's terminal, we could help get them started by displaying some common build commands, a link to a doc, etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we could link to a doc and also run ./build.sh --help
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What build commands or docs do you think are useful here?
Looking around, I don't see others doing this. Maybe it is something we can enable after the initial work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also run ./build.sh --help?
That output is way too verbose to be useful for a new contributor.
If anything here, I could imagine pointing to https://github.com/dotnet/runtime/blob/main/docs/workflow/README.md. Beyond that, I'm not sure of the value of dumping more things out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I only found a few examples: https://grep.app/search?current=3&q=postStartCommand&filter[path][0]=.devcontainer/ and didn't spot any that were simply dumping help.
I had in mind just writing a few lines welcoming folks and pointing them to the readme, and saying to type "./build.sh --help"
yes, no need to do it now unless you feel like it. Just trying to think about how to smooth the path after the dev container starts and they're wondering what to do next. that is, if it even is visible in the terminal. I'm guessing it is.
set -e | ||
|
||
# prebuild the repo, so it is ready for development | ||
./build.sh libs+clr -rc Release |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@safern if we add +libs.pretest
here, will that leave me in a state where I can walk up to any /tests
folder and type dotnet build /t:build;test
without any other prereqs?
If so it's probably worth adding as I'm assuming libs.pretest
is fast.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@danmoseley libs.pretest
is already part of the default subsets for libs
, so no need to add it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I will be able to build and run an individual test library (it doesn't need libs.tests built?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct with the given setup you will be able to run, dotnet build /t:test
on a test project and it will work. libs.tests
is not needed unless you want to run all tests or send to helix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: you can also do just a dotnet test
after a build.cmd/sh clr+libs
, doesn't need to be dotnet build /t:test
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This command is very CLR/Libraries team specific. Would it make sense to build the entire repo instead of just those two subsets? (including host and packs)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Eric has a mail out asking whether there's a way to have multiple flavors of dev container.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can always add more to the build in the future, if this turns out to be valuable to more people.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good. My hope is that in the future we can spend some time on optimizing the repo's root build (including all subsets but with just one selected runtime) which should make it a no-brainer to build the entire repo. More and more parts will be required over time anyway, i.e. we don't use the live built host today in libraries but we want to. Similar for other parts like the targeting pack produced in the "packs" subset.
/braindump end
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excited to try this out.
Does it allow you have to more than one prebuild, like for different configs (eg. wasm :)? |
That's a good question - I'm not sure. I was also thinking about coreclr devs who would potentially want a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Looking forward to seeing how the prebuilds roll out.
Another thing pending for me to add to the config for aspnetcore repo is a more helpful set of default extensions (XML Docs extension, EditorConfig extension, etc). Might be helpful to sort out a good standard set to use across the dotnet repos.
Markdown too and maybe Git. Perhaps we can ask one of our full time VS Code users what they have installed. |
@@ -0,0 +1,17 @@ | |||
name: Create Codespaces Prebuild |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whoa - is this what it looks like? Exciting!
We might later add more to the build (eg libs.tests) if we're typically picking up a cached image.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the prebuild fails, how will we know?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this what it looks like?
yes.
If the prebuild fails, how will we know?
It is a GitHub action. I would hope we can set up rules when it fails to notify someone.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
regions: WestUs2 | ||
sku_name: standardLinux32gb | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this for? No token should be needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Following that to https://docs.github.com/en/actions/security-guides/automatic-token-authentication#example-1-passing-the-github_token-as-an-input it suggests the default permissions are very broad and one can restrict eg
permissions:
contents: read
But I don't grok how this relates to EXPERIMENTAL_CODESPACE_CACHE_TOKEN.
If you believe we're "doing it right" here then that's fine with me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is literally copied from the above doc (and I see the exact same in other repos).
https://github.com/github/codespaces-precache#standard-template
name: precache codespace
on:
push:
branches:
- main
workflow_dispatch:
jobs:
createPrebuild:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: github/codespaces-precache@v1.0.1
with:
regions: WestUs2
sku_name: standardLinux32gb
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
https://github.com/microsoft/vscode/blob/main/.github/workflows/create-codespaces-prebuild.yml
https://github.com/rails/rails/blob/main/.github/workflows/codespaces.yml
@@ -0,0 +1,17 @@ | |||
name: Create Codespaces Prebuild |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the prebuild fails, how will we know?
No, it doesn't show up. |
@eerhardt @captainsafia do you have experience with hosting codespaces containers locally? (the prebuilt ones we should now have every 6 am) I see that VSCode does this: https://github.com/microsoft/vscode/tree/main/.devcontainer |
I don't. If I'm going to use my local machine, I'm going to use it directly, and use Windows + Visual Studio. |
For sure -- if you are a regular committer, you're going to either use your local machine or a CodeSpace. I'm thinking about a casual contributor -- downloading a docker image with the repo already pulled down, prereqs installed and everything built, that could be a signficant improvement over setting it up themselves. CodeSpace would be even better, but as we've seen it's not available to most of them. |
So I haven't tried this with prebuilt images but my patterns for working with dev containers locally have been:
I haven't been able to do something similar to the model you're proposing Dan unfortunately. :/ |
We regularly build wasm using codespaces, we can provide some input |
These are the initial scripts to configure Codespaces in the dotnet/runtime repo.
These settings allow for a successful
./build.sh libs+clr -rc Release
. And then you can develop and test src\libraries projects.