we have our release pipeline from Azure , from there we initiate octopus deployment.
In Octopus deploy steps, we execute sql scripts.
Our issue is, when this sql script execution fails in the middle then we are not able to see the actual error or a detailed log from octopus.
Thank you for contacting Octopus Support and welcome to the forums!
I am sorry to hear you are not seeing much detail in the Octopus logs regarding SQL errors, are you able to see any errors at all in the Octopus task logs for that failed project? Octopus wont show detailed logs of the scripts you are running from within a ‘Run a Script’ step, you would need to see your SQL logs in order to get a more detailed error as Octopus will only log what it sees from SQL which may be something like:
SQL Error 5011 - description of the issue.
Since they are your scripts you are running Octopus may only show exit code 1 which means the script itself failed but Octopus is unable to reach out to SQL and request a reason why, it just knows the script failed to execute.
There are some things that may help in getting more detailed logs but I am unsure if that would get you a more detailed SQL error, I imagine your SQL logs would show why actions performed against a Database failed.
If you are on our Octopus Server product you can change the log level to debug or something other than verbose which may get you a more detailed error message from SQL. Our document on how to do this is here if you have not seen it yet, it does mention changing the log level can increase the size of your Octopus server logs so you would need to be mindful of that.
You could also use the --progress flag in your Octopus CLI commands in Azure DevOps which may help, we have some documentation on this here:
Hopefully that helps, if you have an example of one of the errors you are getting or a full task log we can take a look for you, you can send that to our secure site here if you would like but I would try those suggestions I mentioned above first.