Turn Your Vehicle Into a Smart Earning Asset

While you’re not driving your car or bike, it can still be working for you. MOTOSHARE helps you earn passive income by connecting your vehicle with trusted renters in your city.

🚗 You set the rental price
🔐 Secure bookings with verified renters
📍 Track your vehicle with GPS integration
💰 Start earning within 48 hours

Join as a Partner Today

It’s simple, safe, and rewarding. Your vehicle. Your rules. Your earnings.

Octopus Deploy – How to handle deployment errors and script failure response.

Each of your scripts will be bootstrapped by the open-source Calamari project to provide access to variables and helper functions. You can see how your scripts are bootstrapped in the Calamari source code.

https://github.com/OctopusDeploy/Calamari

https://github.com/OctopusDeploy/Calamari/blob/master/source/Calamari.Shared/Integration/Scripting

Octopus Deploy supports the following scripts:

PowerShell scripts (.ps1)
C# scripts (.csx) using ScriptCS
Bash scripts (.sh)
F# scripts (.fsx)
Python scripts (.py)

When Calamari executes your scripts, it does so within the context of the working directory by default: C:\Octopus\Work\

Calamari examines the exit code of the script engine to determine whether the script failed. If the exit code is zero, Calamari assumes the script ran successfully. If the exit code is non-zero, then Calamari assumes the script failed.

Syntax errors and unhandled exceptions will result in a non-zero exit code from the script engine, which will fail the deployment

Error Handling in PowerShell Scripts – For PowerShell scripts Calamari also sets the $ErrorActionPreference to Stop before invoking your script. This means that if a command fails, the rest of the script won’t be executed. At the end of the script, Calamari also checks $LastExitCode to see if the last Windows-based program that you invoked exited successfully.

Note that you’ll need to check $LastExitCode yourself if you run multiple Windows programs. For example, with this script, Calamari would correctly see that ping returned an exit code of 1 (the host couldn’t be contacted) and will assume the script failed:

  • https://octopus.com/docs/deployment-examples/custom-scripts/error-handling
  • https://octopus.com/docs/deployment-examples/custom-scripts
  • https://octopus.com/docs/deployment-examples/custom-scripts/debugging-powershell-scripts
Subscribe
Notify of
guest
0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments

Certification Courses

DevOpsSchool has introduced a series of professional certification courses designed to enhance your skills and expertise in cutting-edge technologies and methodologies. Whether you are aiming to excel in development, security, or operations, these certifications provide a comprehensive learning experience. Explore the following programs:

DevOps Certification, SRE Certification, and DevSecOps Certification by DevOpsSchool

Explore our DevOps Certification, SRE Certification, and DevSecOps Certification programs at DevOpsSchool. Gain the expertise needed to excel in your career with hands-on training and globally recognized certifications.

0
Would love your thoughts, please comment.x
()
x