Expand retention policy to be version based

kirk.quinbar's Avatar


05 Dec, 2013 04:15 PM

Currently if you setup a retention policy to be based off 3 items, it will delete folders past the 3 items back. In our scenerio we have version numbers in our Nuget packages and in Octopus of WCF services that are hosted in IIS. We found that when Octopus retention policy ends up deleting a folder that is being pointed to by IIS that IIS will then just fails to load the application pool and crash everything else in that same application pool. To address this, can the retention policy be enhanced to support versioning and especially in relation to the tentacle policy? All of our release numbers are in format .... so for example say you already had these releases:

let say gets released. if we based retention policy on major/ minor version, then and would get deleted if we assume we wanted to keep 3 items for each major/minor version. Which parts of the version number are used to determine what retention is based on could be configurable.

  1. Support Staff 1 Posted by Paul Stovell on 05 Dec, 2013 08:33 PM

    Paul Stovell's Avatar

    Thanks for reporting this Kirk. I've noted the issue here:



    *Paul Stovell*
    Octopus Deploy
    W: octopusdeploy.com | T: @octopusdeploy <http://twitter.com/octopusdeploy>

  2. 2 Posted by kirk.quinbar on 22 Sep, 2014 08:44 PM

    kirk.quinbar's Avatar

    I realized recently that I kinda forgot about this issue and was not subscribed to the thread on github. I went through those results, but Im not sure what happened with this. Was this ever addressed and if so how does this work in v2.5.x? the github thread mentioned something about a new variable, but I cannot find any documentation on it's use. Is there a way to accomplish version specific retention yet?

    Done - the special variable is called Octopus.Tentacle.CurrentDeployment.RetentionPolicySubset .

  3. 3 Posted by kirk.quinbar on 22 Sep, 2014 08:45 PM

    kirk.quinbar's Avatar

    fyi, that last sentence about the special variable was cut/pasted from the github thread to show what I saw.

  4. Support Staff 4 Posted by Paul Stovell on 24 Sep, 2014 11:50 AM

    Paul Stovell's Avatar

    Hi Kirk,

    We made a few changes:

    • We figure out which packages should be kept/deleted based on the action/step ID, not the package ID anymore. So if you have three projects, A, B and C which all use the same package but different versions, they won't affect each other
    • I believe you can create your own variable named "Octopus.Tentacle.CurrentDeployment.RetentionPolicySubset" and set it to different values per release/whatever. This will be used to create unique groups of packages to be retained individually. E.g., in your original example, the values could be "1.0", "1.1" and "1.2" to ensure the last 3 of each patch of the major/minor versions are kept.

    Hope this helps!


  5. Paul Stovell closed this discussion on 04 Jan, 2017 07:48 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac