Octo.exe returns exit code 0 regardless of failure

Hi,

I am using Octo.exe to replicate deployment projects between a staging and a production environment using the following powershell code:

  & $octopusToolsPath\octo.exe @('import', '--type=project', "--filePath=$projectFile", '--server',  "https://$Server/", '--apiKey', $ApiKey)
  if ($LASTEXITCODE -ne 0)
  {
    Write-Error "ERROR: octo.exe terminated with ExitCode=$LASTEXITCODE"
  }
  else
  {
    Write-Host "SUCCESS: octo.exe terminated with ExitCode=$LASTEXITCODE"
  }

I found that checking the exit code is not enough because sometimes Octo.exe returns exit code 0 even if the import didn’t happen:

15:39:31   Info     |       Octopus Deploy Command Line Tool, version 3.3.1+Branch.master.Sha.1c8736a1d37db41c04c2540914b4ec688a3d0ed8
15:39:31   Info     |       Handshaking with Octopus server: https://********/
15:39:31   Info     |       Handshake successful. Octopus version: 3.0.19.2485; API version: 3.0.0
15:39:31   Info     |       Authenticated as: ******** <********>
15:39:31   Info     |       Finding importer 'project'
15:39:31   Info     |       Validating the import
15:39:31   Info     |       Export file successfully loaded
15:39:31   Info     |       Checking that lifecycle Default Lifecycle exists
15:39:31   Info     |       Found lifecycle 'Default Lifecycle'
15:39:31   Info     |       Checking that all environments exist
15:39:31   Info     |       Checking that all machines exist
15:39:31   Info     |       Checking that all NuGet Feeds exist
15:39:31   Info     |       Checking that all Action Templates exist
15:39:31   Info     |       Checking that all Library Variable Sets exist
15:39:31   Info     |       Checking that the Project Group exist
15:39:31   Info     |       The following issues were found with the provided import file:
15:39:31   Info     |       Could not find LibraryVariableSet 'TestVariables'
15:39:31   Info     |       SUCCESS: octo.exe terminated with ExitCode=0

Please let me know if there is known solution to this problem.

Thanks,
Daniel

Hi Daniel,

Thanks for getting in touch! I have created a GitHub issue to see if we can fix this; https://github.com/OctopusDeploy/Issues/issues/2280

Thanks for letting us know!
Vanessa

Hi Vanessa,

Thanks for opening the GitHub issue. Do you know what is the usual turnaround time for issues similar to this one?

Many thanks,
Daniel

Hi Daniel,

Probably a week or two in this case.

Vanessa

Hi Vanessa,

Thanks for your response. Please note that the bug is 14 days old in github and there is no sign of any sort of progress.

Kind regards,
Daniel

Hi Daniel,

My estimation was based on when you asked. A week or two from that date.
But it is an estimation of when it can be fit in.

Vanessa

Makes sense, thanks

Hi Vanessa,

I can confirm this has been fixed in OctopusTools 3.3.3

Many thanks,
Daniel

Hi Daniel,

Great! Thanks for letting us know!

Vanessa