in src/Cli/func/Helpers/KuduLiteDeploymentHelpers.cs [91:126]
private static async Task<string> GetLatestDeploymentId(HttpClient client, Site functionApp)
{
var deploymentUrl = "/deployments";
if (functionApp.IsFlex)
{
deploymentUrl = "api/deployments";
}
var deployments = await InvokeRequest<List<DeploymentResponse>>(client, HttpMethod.Get, deploymentUrl);
if (functionApp.IsFlex)
{
if (!deployments.Any())
{
await Task.Delay(TimeSpan.FromSeconds(20));
deployments = await InvokeRequest<List<DeploymentResponse>>(client, HttpMethod.Get, deploymentUrl);
if (!deployments.Any())
{
throw new CliException("The deployment ID couldn't be found. Please try again.");
}
}
}
// Automatically ordered by received time
var latestDeployment = deployments.First();
DeployStatus? status = latestDeployment.Status;
if (status == DeployStatus.Building || status == DeployStatus.Deploying
|| status == DeployStatus.Success || status == DeployStatus.Failed
|| status == DeployStatus.Conflict || status == DeployStatus.PartialSuccess)
{
return latestDeployment.Id;
}
return null;
}