Can Project B return failure to Project A?

I have an Octopus Project, Project A, that calls Project B using octo.exe (specifically through a powershell script that forms an octo.exe create-release statement and passes it). Everything works well when Project B completes successfully, but if Project B fails on any step, Project A still results in a success (False positive).

I currently capture the results of the octo.exe command, and i can successfully return the full dump to Project A. I’m doing something like this, all from Project A -

$scriptOutput = & “D:\Octopus\Octo.exe” “create-release” “–server=http://localhost” “–apikey=$APIKey” “–project=$ProjectToInvoke” “–deployto=$Environment” “–deploymenttimeout=$TimeOutMinutes” “–progress”

$scriptOutput

If($scriptOutput -like “Exit code:”)
{
Exit 1
}

It doesn’t seem to be working, and I wondered if there was an easier way to do this?

Thank you very much,

Tobias

Hi Tobias,

Thanks for reaching out. Just calling Octo.exe as shown below should be enough

& "D:\Octopus\Octo.exe" create-release --server="http://localhost" --apikey="$APIKey" --project="$ProjectToInvoke" --deployto="$Environment" --deploymenttimeout="$TimeOutMinutes" --progress

If that doesn’t work, please let me know which version of Octo.exe and Octopus are you running.

Thanks,
Dalmiro

so from Project A i’m calling a powershell script that checks a manifest file to read in various nuget files that have been marked as stable. So the external powershell script builds the octo.exe statement and actually passes the nuget version for each of the 14 steps in Project B.

I’d prefer that to be an external powershell script, mostly so it can be checked into git and things like that, but are you suggesting i use the internal ‘script block’ from the within octopus to make the actual octo.exe call?

I think what i’ll try then is something like
$OctoString = & D:\somefile.ps1 -variables

& “D:\Octopus\Octo.exe” $OctoString

That way I can still form my full octo.exe string externally, but take advantage of Project B’s exit codes?

Hi Tobias,

The script can be on a file in the package (this feature was introduced in 3.3) or as part of the script block. It totally makes sense that you’d rather use the first approach to take advantage of your source control tracking.

The command I gave you should work in both cases.

Let me know what happens when you try it.

Thanks,
Dalmiro

Dalmiro,

yes, that worked perfectly. Not only am I seeing failures in Project B report back to Project A, I’m getting a much cleaner output in the GUI when I call & “D:\Ocotpus\octo.exe” directly from Project A.

Thank you very much,

Tobias