Host custom port (#32)
* Add handling for container group provisioning failure * allow custom port, and get IP from DNS using 'host' parameter Co-authored-by: stas <statis@microsoft.com>
This commit is contained in:
Родитель
004acf981c
Коммит
2be8e1a0b2
|
@ -615,9 +615,21 @@ let main argv =
|
|||
return Result.Error("Failed to retrieve IP from DNS")
|
||||
else
|
||||
return Result.Ok(dns.[0].ToString(), targetPort)
|
||||
| _, Some endpointConfiguration ->
|
||||
printfn "Endpoing configuration is set, going to use it: %A" endpointConfiguration
|
||||
return Result.Ok(endpointConfiguration.Ip, endpointConfiguration.Port)
|
||||
| Some host, Some endpointConfiguration ->
|
||||
match endpointConfiguration.Ip with
|
||||
| Some ip ->
|
||||
printfn "Endpoint configuration is set, going to use it: %A" endpointConfiguration
|
||||
return Result.Ok(ip, endpointConfiguration.Port)
|
||||
| None ->
|
||||
printfn "Endpoint configuration is set, going to use it: %A" endpointConfiguration
|
||||
return Result.Ok(host, endpointConfiguration.Port)
|
||||
| None, Some endpointConfiguration ->
|
||||
match endpointConfiguration.Ip with
|
||||
| Some ip ->
|
||||
printfn "Endpoint configuration is set, going to use it: %A" endpointConfiguration
|
||||
return Result.Ok(ip, endpointConfiguration.Port)
|
||||
| None ->
|
||||
return Result.Error("Must set either target endpoint IP or host")
|
||||
}
|
||||
|
||||
let test (testType: string) checkerOptions (jobConfiguration: RunConfiguration) =
|
||||
|
|
|
@ -71,7 +71,7 @@ type ReplayConfiguration =
|
|||
type TargetEndpointConfiguration =
|
||||
{
|
||||
/// The IP of the endpoint being fuzzed
|
||||
Ip: string
|
||||
Ip: string option
|
||||
|
||||
/// The port of the endpoint being fuzzed
|
||||
Port: int
|
||||
|
|
|
@ -1225,10 +1225,13 @@ module ContainerInstances =
|
|||
let isJobManuallyStopped (g: IContainerGroup) =
|
||||
g.State = ContainerGroupStates.Stopped
|
||||
|
||||
let isJobProvisioningFailed (g:IContainerGroup) =
|
||||
g.State = ContainerGroupStates.Failed || g.ProvisioningState = ContainerGroupStates.Failed
|
||||
|
||||
/// Job is finished if every container is terminated
|
||||
let isJobRunFinished (g: IContainerGroup) =
|
||||
if Tags.isGcReady g.Tags then
|
||||
(g.State = ContainerGroupStates.Failed || g.ProvisioningState = ContainerGroupStates.Failed)
|
||||
isJobProvisioningFailed g
|
||||
||
|
||||
(
|
||||
(g.State = ContainerGroupStates.Succeeded || g.State = ContainerGroupStates.Stopped)
|
||||
|
@ -1355,10 +1358,20 @@ module ContainerInstances =
|
|||
logInfo "[GC] All containers [Count: %d] terminated for container group: %s" g.Containers.Count g.Name
|
||||
|
||||
if jobRunFinished || jobManuallyStopped || isExpired then
|
||||
let containerGroupFailedToProvision = isJobProvisioningFailed g
|
||||
let instancesExitedWithError = getContainersExitedWithError g
|
||||
|
||||
let state, details =
|
||||
if isExpired then
|
||||
if containerGroupFailedToProvision then
|
||||
JobState.Error,
|
||||
(Map.empty, g.Events |> List.ofSeq)
|
||||
||> List.fold( fun details v ->
|
||||
details
|
||||
.Add("Name", v.Name)
|
||||
.Add("Message", v.Message)
|
||||
.Add("Type", v.Type)
|
||||
)
|
||||
else if isExpired then
|
||||
JobState.TimedOut, Map.empty
|
||||
else if jobManuallyStopped then
|
||||
JobState.ManuallyStopped, Map.empty
|
||||
|
@ -1367,7 +1380,7 @@ module ContainerInstances =
|
|||
else
|
||||
//There is at least one container that terminated with an error
|
||||
JobState.Error,
|
||||
(Map.empty, instancesExitedWithError |> List.ofSeq)
|
||||
(Map.empty, instancesExitedWithError |> List.ofSeq)
|
||||
||> List.fold (fun details v ->
|
||||
details.Add(
|
||||
(sprintf "[%s] Exit Code" v.Name), sprintf "%A" v.InstanceView.CurrentState.ExitCode
|
||||
|
|
Загрузка…
Ссылка в новой задаче