Custom Deployment Scripts only showing output on last script

My deployment step has both a deployment and post-deployment PowerShell script that run. I only get the output (write-host “cool stuff”) on the post-deployment script in the task summary. Is there a way to get the logging to work in the deployment script also?

Hi Chris,

That doesn’t sound right, you should be able to see the output from all the scripts in our logging.

So that I can investigate this one a little more would you be able to send through your raw task logs, and if possible some screenshots showing what you are seeing in Octopus as well?

Thanks Chris, I’ve marked this conversation as private so that only Octopus staff will be able to see the logs and screenshots.

Regards,
Alex

Below is the step template.

{
“Id”: “ActionTemplates-241”,
“Name”: “Deploy Package with Config Multi Instance”,
“Description”: null,
“ActionType”: “Octopus.TentaclePackage”,
“Version”: 7,
“CommunityActionTemplateId”: null,
“Properties”: {
“Octopus.Action.Package.AutomaticallyRunConfigurationTransformationFiles”: “True”,
“Octopus.Action.Package.AutomaticallyUpdateAppSettingsAndConnectionStrings”: “False”,
“Octopus.Action.EnabledFeatures”: “Octopus.Features.CustomScripts,Octopus.Features.SubstituteInFiles”,
“Octopus.Action.Package.DownloadOnTentacle”: “False”,
“Octopus.Action.Package.FeedId”: “feeds-builtin”,
“Octopus.Action.Package.PackageId”: “#{Octopus.Project.Name}”,
“Octopus.Action.SubstituteInFiles.Enabled”: “True”,
“Octopus.Action.CustomScripts.Deploy.ps1”: “if ($OctopusParameters[“Octopus.Environment.Name”] -eq “Pre-Integration”){\n New-CopyFiles\n }\nelse {\n New-CopyFilesMultiInstance\n}\n”,
“Octopus.Action.CustomScripts.PostDeploy.ps1”: “#New-ClearFolder\nInvoke-SyncNextInstance”,
“Octopus.Action.CustomScripts.PreDeploy.ps1”: “<#Function Mailer ($message, $subject) \n\n{ \n \n \n $emailFrom = "OctopusDeploy@chrobinson.com” \n \n $smtpserver=“mail.chrobinson.com” \n $smtp=new-object Net.Mail.SmtpClient($smtpServer) \n $smtp.Send($emailFrom, $OctopusParameters[“Octopus.Deployment.CreatedBy.Username”], $subject, $message) \n} \n$adminChk = $OctopusParameters[“Octopus.Action[Initialize Deploy].Output.adminChk”]\nif ($adminChk -eq $false){\n \n if ($OctopusParameters[“Octopus.Action[Purge Packages].Output.PurgePackages”] -eq $true){\n Set-OctopusVariable -Name ‘packVer’ -Value $OctopusParameters[“Octopus.Action.Package.PackageVersion”]\n Set-OctopusVariable -Name ‘deployPack’ -Value $true\n }\n else {\n Write-Output “Cannot Skip steps. Rerun the Deploy without skipping steps.”\n $message = @"\n Cannot Skip steps. Rerun the Deploy without skipping steps.\n"@ \n Mailer $message “Check Previous Step Completed Failure.”\n EXIT 1\n }\n}\nelse {\n Set-OctopusVariable -Name ‘packVer’ -Value $OctopusParameters[“Octopus.Action.Package.PackageVersion”]\n}#>",
“Octopus.Action.Package.CustomInstallationDirectoryShouldBePurgedBeforeDeployment”: “False”,
“Octopus.Action.SubstituteInFiles.TargetFiles”: “*.config”
},
“Parameters”: [],
“$Meta”: {
“ExportedAt”: “2019-04-26T13:06:46.125Z”,
“OctopusVersion”: “2018.6.6”,
“Type”: “ActionTemplate”
}
}

IT seems I get the output from the post deploy script but not the other scripts. All Powershell and using write-output. They are functions in a script module library. I can post more but starting small for now.

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