Logging a release details in real time

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
   }
}

Hi @jason02,

Thanks for getting in touch! Unfortunately, the Octopus.Client is not able to work in real time with your releases in the way you intend. However, it is worth noting that our Octo.exe cli does have this ability.

Here is our documentation page on the Octo.exe create-release function. Using the Octopus CLI will log the deployment details in real time.

For a full list of Octo.exe functions, we have the following documentation page.

Does this look like it will be a suitable substitution to the Octopus.Client for your needs?

If you have any questions at all or run into any issues with the Octopus CLI, please don’t hesitate to let me know.

Best regards,
Daniel

Thanks. Is there a way that I can at least display a link to the deployment in progress using the Octopus Client? Similar to how the ‘Deploy a Release’ template’ has a ‘View Deployment’ link?

Hi jason02,

I’m sorry for the delay in response.

It does not appear that there is a way to generate a link to the deployment task created in the Octopus Client at this time. You can, however, use --progress as an alternative.

I wish I had a better answer for you. Please let us know if you have any additional questions.

Regards,
Donny

Thanks, I’ll go with the route you have suggested

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.