protected override async Task OnBeginSession() { var message = new DeploySessionBeginRequest { DeploymentNumber = session.DeploymentNumber, ServerSessionId = session.SessionId, SessionClientId = SessionClientId, ProjectPackageId = session.ProjectPackageId, ProjectPackageVersion = session.ProjectPackageVersion, Variables = session.Variables, EnvironmentName = session.EnvironmentName, }; var response = await MessageClient.Send(message) .GetResponseAsync <DeploySessionBeginResponse>(); AgentSessionId = response.AgentSessionId; }
public async Task BeginAsync() { try { await messageClient.ConnectAsync(definition.TcpHost, definition.TcpPort); context.Output .Append("Connected to Agent ", ConsoleColor.DarkGreen) .AppendLine(definition.Name, ConsoleColor.Green); } catch (Exception error) { context.Output .Append("Failed to connect to Agent ", ConsoleColor.DarkYellow) .Append(definition.Name, ConsoleColor.Yellow) .AppendLine($"! {error.Message}", ConsoleColor.DarkYellow); throw new ApplicationException($"Failed to connect to Agent '{definition.Name}'! {error.Message}"); } var message = new DeploySessionBeginRequest { ServerSessionId = context.ServerSessionId, ProjectPackageId = context.ProjectPackageId, ProjectPackageVersion = context.ProjectPackageVersion, }; try { var response = await messageClient.Send(message) .GetResponseAsync <DeploySessionBeginResponse>(); AgentSessionId = response.AgentSessionId; } catch (Exception error) { throw new ApplicationException($"Failed to start Agent Session! {error.Message}"); } //if (string.IsNullOrEmpty(AgentSessionId)) // throw new ApplicationException("Failed to begin agent session!"); }