The image shows an isometric illustration of a central octopus-like icon connected to multiple brain icons in a hub-and-spoke network pattern against a purple-to-blue gradient background.

Octopus Easy Mode - Retries

Matthew Casperson
Matthew Casperson

In the previous post, you added a manual intervention step before deploying to production. In this post, you’ll add retry logic to the steps in our deployment process.

Prerequisites

  • An Octopus Cloud account. If you don’t have one, you can sign up for a free trial.
  • The Octopus AI Assistant Chrome extension. You can install it from the Chrome Web Store.

The Octopus AI Assistant will work with an on-premises Octopus instance, but it requires more configuration. The cloud-hosted version of Octopus doesn’t need extra configuration. This means the cloud-hosted version is the easiest way to get started.

Creating the project

Paste the following prompt into the Octopus AI Assistant and run it:

Create a Script project called "04. Script App with Retries", and then:
* Enable retries on the script step
* Replace the script with one that randomly fails by returning a non-zero exit code 50% of the time

You can now create a release and deploy it to the first environment. 50% of the time, the script step will fail, triggering the retry logic.

I’ve seen cases where the LLM generates invalid PowerShell, usually with a double dollar sign ($$) instead of a single dollar sign ($). However, invalid scripts will also trigger the retry logic, which is what we want to demonstrate here.

An exercise for the reader is to modify the prompt to ensure valid PowerShell is always generated.

What just happened?

You created a sample project with:

  • A script step with a simulated failure and with retries enabled.

What’s next?

The next step is to consume build information from our deployment process.

Matthew Casperson

Related posts