-
Notifications
You must be signed in to change notification settings - Fork 311
Adds hosting model as an extra deployment parameter #1261
Conversation
@jkotalik, |
@@ -106,6 +106,8 @@ public class DeploymentParameters | |||
|
|||
public string PublishedApplicationRootPath { get; set; } | |||
|
|||
public HostingModel HostingModel { get; set; } |
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.
Set a default value?
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.
Other values don't have default values (including enums). See: https://github.com/aspnet/Hosting/pull/1261/files#diff-8478a3aebbec4604e8f2cf79bb152195R105
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.
By default, it would take the first value as the default (or whatever is the enum equivalent of 0). Do we want to default all tests to InProcess?
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.
Probably should be out of process.
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'm okay with changing the order of the enums but personally I prefer the more explicit approach where we just set the default value. Takes out all ambiguity.
@@ -148,6 +148,9 @@ private async Task<(Uri url, CancellationToken hostExitToken)> StartIISExpressAs | |||
{ | |||
Logger.LogTrace($"Config File Content:{Environment.NewLine}===START CONFIG==={Environment.NewLine}{{configContent}}{Environment.NewLine}===END CONFIG===", serverConfig); | |||
} | |||
var hostingModel = DeploymentParameters.HostingModel.ToString(); | |||
serverConfig.Replace("[HostingModel]", hostingModel); | |||
Logger.LogDebug("Writing HostingModel '{hostingModel} to ", hostingModel); |
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.
mismatched single quote and missing "config" after "to"
@@ -148,6 +148,9 @@ private async Task<(Uri url, CancellationToken hostExitToken)> StartIISExpressAs | |||
{ | |||
Logger.LogTrace($"Config File Content:{Environment.NewLine}===START CONFIG==={Environment.NewLine}{{configContent}}{Environment.NewLine}===END CONFIG===", serverConfig); | |||
} | |||
var hostingModel = DeploymentParameters.HostingModel.ToString(); | |||
serverConfig.Replace("[HostingModel]", hostingModel); |
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 not just chain it here:
Hosting/src/Microsoft.AspNetCore.Server.IntegrationTesting/Deployers/IISExpressDeployer.cs
Lines 138 to 141 in 05fd382
serverConfig = | |
serverConfig | |
.Replace("[ApplicationPhysicalPath]", contentRoot) | |
.Replace("[PORT]", port.ToString()); |
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 contentRoot and port are inputs to StartIISExpressAsync. HostingModel isn't guaranteed to be set. I will add a check to see if HostingModel exists before setting it though.
korebuild-lock.txt
Outdated
@@ -1,2 +1,2 @@ | |||
version:2.1.0-preview1-15549 | |||
commithash:f570e08585fec510dd60cd4bfe8795388b757a95 | |||
version:2.1.0-preview1-15564 |
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.
@natemcmaster are these changes expected every now and then?
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.
sure, if you need a new version of build tools. The only reason to hold off for now is that the jump from 2.1.0-preview1-15549 to 2.1.0-preview1-15564 puts you ahead of aspnet/Universe
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.
@@ -149,6 +149,13 @@ private async Task<(Uri url, CancellationToken hostExitToken)> StartIISExpressAs | |||
Logger.LogTrace($"Config File Content:{Environment.NewLine}===START CONFIG==={Environment.NewLine}{{configContent}}{Environment.NewLine}===END CONFIG===", serverConfig); | |||
} | |||
|
|||
if (serverConfig.Contains("[HostingModel]")) |
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.
Not needed as string.Replace will no-op if the old value is not found. Also we should not change the config after the changes were logged in https://github.com/aspnet/Hosting/pull/1261/files#diff-727b9f7850879229f0c886f7448a0b04R149. I still think it's best to include these updates at https://github.com/aspnet/Hosting/pull/1261/files#diff-727b9f7850879229f0c886f7448a0b04R138
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 check is for logging. It doesn't make sense to say we are replacing the hostingModel if the hosting model isn't replaced. I do agree with moving it above the config file content though.
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.
These are debug logs so there's no harm in saying we tried replacing the hosting model but didn't end up finding anything to replace. Then again, I don't feel too strongly about it either way.
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.
Before checking this in, can you try adding a test that tests the in proc hosting model. In server tests maybe?
The tests in IISIntegration are effectively the same as what are in ServerTests. However those tests are currently disabled until ANCM is in universe. If IIS integration relies on a new change to ANCM, there is no way to pick up that change. Eventually, ServerTests will have tests for InProcess, however it is too painful. |
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.
Our travis builds seem to be unreliable lately. Random errors all the time. Not related to this change though.
For #1260