Create a standalone power-shell post deploy step with below code
$ProjectName = $OctopusParameters[‘Octopus.Project.Name’]
write-Host $ProjectName
write-Host $OctopusParameters[‘Octopus.Deployment.Error’]
write-Host $OctopusParameters[‘Octopus.Deployment.ErrorDetail’]
Made the deploy step to fail.
checked the log, Octopus.Deployment.ErrorDetail not working
Logs snippet
Running PowerShell script: C:\Windows\system32\config\systemprofile\AppData\Local\Tentacle\Temp\ae69bb77-42d9-444a-b1e6-3b8f98657e26.ps1
07:57:50 Info | Deployto_Green
| Operation: Running step “test” on “10-4-114-135” failed with error: One or more items in the current operation failed.
07:57:50 Info | ==============================================
| PowerShell exit code: 0
| ==============================================
07:58:06 Info | Tentacle script execution
using 2.6.5 version
Hi,
Sorry you’re having trouble with this!
Unfortunately this is a known bug in version 2.6.5. It has been fixed for Octopus 3.0.
To future-proof your code, you might want to check that the Octopus.Deployment.ErrorDetail
has a value and write it only if it’s not null.
I hope this helps,
Damo
Hi,
with 2.5 Only Octopus.Deployment.Error and other variable are not working. are they fixed as a pert of 3.0
write-Host "Error"
write-Host $OctopusParameters[‘Octopus.Deployment.Error’]
write-Host "ErrorDetail"
write-Host $OctopusParameters[‘Octopus.Deployment.ErrorDetail’]
write-Host "Statuscode"
write-Host $OctopusParameters[‘Octopus.Step.Status.Code’]
write-Host "StatusError"
write-Host $OctopusParameters[‘Octopus.Step.Status.Error’]
write-Host "StatusErrorDetail"
write-Host $OctopusParameters[‘Octopus.Step.Status.ErrorDetail’]
Hi,
If there are no errors, none of those variables will have a value. The Error
and ErrorDetail
values will be empty, and because you’re actively running the step, none of the other variables will have values either.
Try this:
write-Host "Error"
if ($OctopusParameters['Octopus.Deployment.Error'] -ne $null) {
Write-Host "No value"
}
write-Host $OctopusParameters['Octopus.Deployment.Error']
write-Host "ErrorDetail"
if ($OctopusParameters['Octopus.Deployment.ErrorDetail'] -ne $null) {
Write-Host "No value"
}
write-Host "Statuscode"
write-Host $OctopusParameters['Octopus.Step[STEP NAME GOES HERE].Status.Code']
The valid variables should be visible in the Verbose log if you add the OctopusPrintEvaluatedVariables
variable to your project. See the attached screenshot.
I feel like you’re trying to diagnose a deployment issue - can you tell me what’s going wrong? Maybe we can help with the root cause rather than just answering lots of small questions?
Thanks,
Damo