-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
feat (codespaces) - Add initial support for codespaces #27483
Conversation
source the path so that user can access `sql-cmd` right off.
@captainsafia Kevin mentioned that you had some experience of enabling codespaces. Could you take a look at this and see what you think? |
"omnisharp.enableRoslynAnalyzers": true, | ||
"omnisharp.enableEditorConfigSupport": true, | ||
"omnisharp.enableImportCompletion": true, | ||
"omnisharp.useModernNet": true, |
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.
Oooh! Interesting. I think we probably want to enable this in the aspnetcore repo too.
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.
You mean the last option right? useModernNet
? Yes, right now am using it in codespaces for the aspnetcore repo. But somehow the intellisense got slowed because of this. Am still figuring out that one for the aspnetcore repo. But this works great here in efcore repo.
"settings": { | ||
"mssql.connections": [ | ||
{ | ||
"server": "localhost,1433", |
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.
I assume this is here so the SQL extension can automatically connect to the dev database from VS Code?
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.
Yes, interestingly, I can able to run tests from the efcore repo directly against this DB!
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.
Test__SqlServer__DefaultConnection
below makes it happen.
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.
Yes, exactly I did that based on docs on repo!
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.
The Codespaces specific stuff looks legit.
I'm not experienced with the mssql
bit of things but it seems like a sensible dev setup.
Yes, I want people from the EF core repo (who do commit every day to this repo) to try this and provide feedback. Because the experience is quite great for old and newcomers as well. We can write code, write tests, execute against local DB which is inside codespace and much more! Please give it a try EF core 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.
The SQL Server setup looks good to me, thanks!
I'm no VS Code/Codespaces expert and didn't verify this all the way (a VS Code test runner would need to be installed etc.), but is looks good enough to merge. Will leave this open for a few more days in case someone else from the team feels like playing around with it.
dacpath=$2 | ||
sqlpath=$3 | ||
|
||
echo "SELECT * FROM SYS.DATABASES" | dd of=testsqlconnection.sql |
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.
Any reason not to simplify to:
echo "SELECT * FROM SYS.DATABASES" | dd of=testsqlconnection.sql | |
echo "SELECT * FROM SYS.DATABASES" > testsqlconnection.sql |
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 script was automatically created when we asked codespaces to include support for SQL Server. So I didn't touch.
Sorry for the late reply! :(
echo "SELECT * FROM SYS.DATABASES" | dd of=testsqlconnection.sql | ||
for i in {1..60}; | ||
do | ||
/opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P $SApassword -d master -i testsqlconnection.sql > /dev/null |
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.
Or even better: sqlcmd supports providing a query on the cmdline with -Q, can use that instead of a temp file
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.
the script was created by codespaces itself. I didn't write this!
If we can improve it by any means, I am ok with it! :)
Thanks @ShreyasJejurkar for the PR, and thanks @captainsafia for the review. |
"DOTNET_MULTILEVEL_LOOKUP": "0", | ||
"TARGET": "net7.0", | ||
"DOTNET_WATCH_SUPPRESS_LAUNCH_BROWSER": "true", | ||
"Test__SqlServer__DefaultConnection ": "Server=localhost;Database=master;User Id=sa;password=Pass@word;Trusted_Connection=False;MultipleActiveResultSets=true;" |
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 space at the end of env var correct? While repo will build/test fine if SqlServer is not running, need to see if SqlServer tests actually ran.
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.
Yes, before creating this PR, I run all tests with the script which is at the root of the repo, not even a single test case failed!
This reverts commit 9599197.
@ajcvickers Aw shucks! Any reason this needed to be reverted? I'm trying to stay aware of any Codespace-related issue affecting our repos. |
@captainsafia "Passwords are not allowed in config files." Will forward you the internal email on this. |
tasks.json
can be invoked using pressing CTRL + SHIFT + P and selecting Run Tasks as an option.sql-cmd
to the PATH, so that users can access DB right off after the creating container. Developers can access bothsql-cmd
on the command line and with GUI inside VSCode for SQL Server.Once all changes as done as part of PR feedback, planning to include a section for VSCode and codespaces users on how to build, developed, and test EF in the cloud in this doc => https://github.com/dotnet/efcore/blob/main/docs/getting-and-building-the-code.md.