Timing for Retention Policy Execution

The documentation says that the retention policy executes after the deployment successfully completes. While the checklist order follows that, the actual execution seems to differ. For instance, the last few steps in our deployments are as follows (along with the times they executed from the log):

  • Copy Website Files - completion - INFO 12:46:08
  • Delete App Offline INFO 12:46:41
  • Send Deployment Report Email INFO 12:46:47
  • Apply Retention Policy INFO 12:46:08

That last step actually occurs between the first two. This is an issue because it keeps our site down for a while longer than it needs to. I don’t care if it comes before the deployment email, but I really need it to come after deleting the app offline file. We are running Octopus 3.1.3. Any help would be appreciated.

Hi,

Thanks for getting in touch!

The Tentacle retention policy runs after all after all package acquisition steps have completed (e.g. all the NuGet package steps in your deployment process). This means that you have any script steps or email steps (like you do) these may happen after the retention policy runs.

What you can do is have your Delete App Offline step as a custom post-deploy script in your Copy Website Files step and this way it will run before the Tentacle retention policy runs.

Hope that helps!

Thank you and kind regards,
Henrik