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