perf(deploy): flatten-session caching, bulk DeploySiteAsync, paged management queries
This commit is contained in:
@@ -19,6 +19,7 @@ public static class DeployCommands
|
||||
var command = new Command("deploy") { Description = "Deployment operations" };
|
||||
|
||||
command.Add(BuildInstance(urlOption, formatOption, usernameOption, passwordOption));
|
||||
command.Add(BuildSite(urlOption, formatOption, usernameOption, passwordOption));
|
||||
command.Add(BuildArtifacts(urlOption, formatOption, usernameOption, passwordOption));
|
||||
command.Add(BuildStatus(urlOption, formatOption, usernameOption, passwordOption));
|
||||
|
||||
@@ -39,6 +40,43 @@ public static class DeployCommands
|
||||
return cmd;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Builds <c>deploy site</c> — bulk-deploy every instance at one site.
|
||||
///
|
||||
/// <para>
|
||||
/// Sits under <c>deploy</c> alongside <c>deploy instance</c> and
|
||||
/// <c>deploy artifacts</c>, naming the SCOPE of the deploy as the verb, which
|
||||
/// is the convention the group already follows. Note it is deliberately NOT
|
||||
/// fleet-wide when <c>--site-id</c> is omitted (the pattern <c>deploy
|
||||
/// artifacts</c> uses): a bulk instance deploy is far more consequential than
|
||||
/// an artifact push, so the target site is required rather than defaulted.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
private static Command BuildSite(Option<string> urlOption, Option<string> formatOption, Option<string> usernameOption, Option<string> passwordOption)
|
||||
{
|
||||
var siteIdOption = new Option<int>("--site-id") { Description = "Target site ID", Required = true };
|
||||
var cmd = new Command("site") { Description = "Deploy every deployable instance at a site" };
|
||||
cmd.Add(siteIdOption);
|
||||
cmd.SetAction(async (ParseResult result) =>
|
||||
{
|
||||
var siteId = result.GetValue(siteIdOption);
|
||||
return await CommandHelpers.ExecuteCommandAsync(
|
||||
result, urlOption, formatOption, usernameOption, passwordOption,
|
||||
new MgmtDeploySiteCommand(siteId),
|
||||
// A bulk deploy is N instance round-trips; the default 30 s client
|
||||
// timeout would abandon the request while the server is still
|
||||
// applying. Matches the server-side long-running Ask window.
|
||||
timeout: BulkDeployTimeout);
|
||||
});
|
||||
return cmd;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Client-side timeout for the bulk site deploy, matching the management
|
||||
/// service's long-running command Ask window.
|
||||
/// </summary>
|
||||
internal static readonly TimeSpan BulkDeployTimeout = TimeSpan.FromMinutes(5);
|
||||
|
||||
private static Command BuildArtifacts(Option<string> urlOption, Option<string> formatOption, Option<string> usernameOption, Option<string> passwordOption)
|
||||
{
|
||||
var siteIdOption = new Option<int?>("--site-id") { Description = "Target site ID (all sites if omitted)" };
|
||||
|
||||
Reference in New Issue
Block a user