Hi Team,
I’m using the Octoups client to create release and I would like for the logging that occurs during a release to occur in ‘real time’ like how it is done when running a step natively in Octopus.
So far the code(shown below) that I have creates a release, but the progress/logging isn’t displayed until the task is complete. So the end user is basically staring at the screen for minutes not knowing whats going on until the release completes. If there isn’t a way to provide a log in real time using the Octopus client, is it possible to at least display a link to the release so that the end user can navigate to it?
$newRelease = $repository.Releases.Create($release, $false)
$deployment = new-object Octopus.Client.Model.DeploymentResource
$deployment.ReleaseId = $newRelease.Id
$deployment.ProjectId = $newRelease.ProjectId
$deployment.EnvironmentId = $currentEnvironment.Id
$deployment.ChannelId = $channel.Id
$deployment.TenantId = $tenantId
$created = $repository.Deployments.Create($deployment)
$task = $repository.Tasks.Get($created.TaskId)
$repository.Tasks.WaitForCompletion($task)
foreach($t in $repository.Tasks.Get($created.TaskId))
{
if($t.Completed)
{
if($t.FinishedSuccessfully)
{
Write-Host "Task finished successfully" $t.Description $t.State $t.Completed $t.IsCompleted
$log = $repository.Tasks.GetRawOutputLog($t)
Write-Host $log
}
else
{
Write-Host "Task Failed" $t.Description $t.State $t.Completed $t.IsCompleted $t.ErrorMessage
$log = $repository.Tasks.GetRawOutputLog($t)
Write-Host $log
exit 1
}
break
}
}