-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
The Azure cloud shell connector #1808
Conversation
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, we will want to find a solution that doesn't require us to commit the entire VCPKG nuget package into the repository since it's 50+MB.
src/cascadia/TerminalApp/App.cpp
Outdated
// Create a Conhost connection based on the values in our settings object. | ||
TerminalConnection::ITerminalConnection controlConnection = TerminalConnection::ConhostConnection(controlSettings.Commandline(), controlSettings.StartingDirectory(), 30, 80, winrt::guid()); | ||
TerminalConnection::ITerminalConnection controlConnection{ nullptr }; | ||
if (controlSettings.Commandline() == L"Azure") |
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 magic string L"Azure" is used in multiple places. It should be defined once as a constant imported into all useful locations.
(This will still be applicable if you change it to an enum or guid)
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, we will want to find a solution that doesn't require us to commit the entire VCPKG nuget package into the repository since it's 50+MB.
I recently discovered I had to use vcpkg
to install cpprestsdk:x64-windows
.
One solution would be to move away from submodules to git subtrees.
https://blog.developer.atlassian.com/the-power-of-git-subtree/
This would reduce the burden of a submodule which by default pulls in the entire repo (and its history).
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 love subtrees, but.. we're not using submodules for cpprest or anything vcpkg-related.
Creating a public Azure DevOps Artifacts Feed may be a better option than checking in the NuGet packages. |
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.
Michael has a bunch of other good comments already - I'll make a second pass when those are addressed
@ras0219-msft, as far as I could find... this is not a thing that exists. There was no such thing as a public feed. There's a 100% private feed, and a partially private feed for just your org. But there's no straight up public feed that anyone can pull from. |
https://dev.azure.com/ms/Terminal has a banner on the top saying we can't publish artifacts after 7/15 without billing. @DHowett-MSFT, can you track down whomever owns the MS instance and have them fix the billing? |
…. The connector now has the ability to store tokens for future logins
…rinting/comments changes
|
||
//Initialize the request | ||
http_request tenantRequest(L"GET"); | ||
tenantRequest.set_request_uri(L"tenants?api-version=2018-01-01"); |
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 it's intentional that they're different? It just looks like an accident/typo.
…r to App to create connection, arm64 *should* build now
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'd say none of my concerns really rise above the level of a nit. Nice work with this!
src/cascadia/TerminalApp/App.cpp
Outdated
// Remove the TabView from the page. We'll hang on to it, we need to | ||
// put it in the titlebar. | ||
uint32_t index = 0; | ||
if (terminalPage->Root().Children().IndexOf(_tabRow, |
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.
Should we maybe (file a follow up task) to display an error dialog if they try using the azure connection type in arm64?
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.
Might not be a bad idea, though I think its an issue that very few people will run into - there's no default profile for an azure connection in an arm64 build, so someone would have to build in non-arm64 first (therefore getting a profiles file with the azure connection as an option), and then build arm64 and use that same profiles file and then try to open up an azure connection to run into that error. At the same time its not hard to implement so I guess we could just do it
// - the handler | ||
// Return value: | ||
// - the event token for the handler | ||
winrt::event_token AzureConnection::TerminalOutput(Microsoft::Terminal::TerminalConnection::TerminalOutputEventArgs const& handler) |
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 think we might have some DEFINE_EVENT_HANDLER
macros lying around so you don't need to put these in here manually, but they're fine for now.
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. They're in src\cascadia\inc\cppwinrt_utils.h
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.
Ah I was just following the way ConhostConnection.cpp did it
// We are connected, continuously read from the websocket until its closed | ||
case State::termConnected: | ||
{ | ||
while (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.
Why didn't this state get it's own helper method 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.
It felt like the real meat of the output thread (since its the state we'll be in most of the time) so it really was just a stylistic choice to leave it there. Can change it if anyone feels strongly about 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.
Make sure we have the Copyright header at the top of these new files. I think there's some missing.
Also, GitHub gave me a super not-useful diff on App.cpp and WindowsTerminal.vcxproj. I'll try and get around to those sometime, but I think there aren't many changes there right?
// - the handler | ||
// Return value: | ||
// - the event token for the handler | ||
winrt::event_token AzureConnection::TerminalOutput(Microsoft::Terminal::TerminalConnection::TerminalOutputEventArgs const& handler) |
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. They're in src\cascadia\inc\cppwinrt_utils.h
93ddc19
to
a791993
Compare
I still don't see notes anywhere about why ARM64 is compiled out. I know why, we talked about it. I just want to see it commented in the 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.
Couple quick questions, but I wouldn't block on them.
_HeaderHelper(shellRequest); | ||
const auto innerBody = json::value::parse(U("{ \"osType\" : \"linux\" }")); | ||
json::value body; | ||
body[U("properties")] = innerBody; |
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.
curious why you parsed json to get the inner value, then manually created the outer value. you could manually create both, or parse json ({"properties":{"osType":"linux"}}
) for both 😄
refreshRequest.set_request_uri(_tenantID + L"/oauth2/token"); | ||
const auto body = L"client_id=" + AzureClientID + L"&resource=" + _wantedResource + L"&grant_type=refresh_token" + L"&refresh_token=" + _refreshToken; | ||
refreshRequest.set_body(body, L"application/x-www-form-urlencoded"); | ||
refreshRequest.headers().add(L"User-Agent", resource); |
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 may need a better user agent than Terminal
; perhaps we can get it from the package version (like App.cpp does?)
#2096 will remove the static analysis build here. |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
* We can now connect to the Azure cloud shell microsoft#1235
🎉 Handy links: |
Implemented a new connection type, the Azure cloud shell connector
#1235
PR Checklist