Tentacle retention policy variable

Is there currently a powershell variable available that contains the retention details that will be applied on the tentacle?

We have a situation where we are coping the files to a custom install location and we would like to be able to synchronize the files we keep in that directory with the retention policy defined in Octopus.

Hi Sean,

Thanks for reaching out. I believe i don’t quite understand what you are trying to do.

The 2 variables we use that contain Retention Policy information are

[OctopusRetentionPolicyItemsToKeep]

[OctopusRetentionPolicySet]

Which usually have info like

[OctopusRetentionPolicyItemsToKeep] = '1'

[OctopusRetentionPolicySet] = 'Environments-33/projects-1/Step-My Deployment Step/machines-226/<default>'

But i’m not sure how they will help you with your task. Could you give me an example of what you are trying to acomplish?

Thanks!

Absolutely! :slight_smile:

We are basically using Octopus to give visibility around what versions of a thick client application are on what environments.

Octopus packs up the installer and installs it to a file server (has to be a special file/folder structure for another deployment tool). This happens on every merge for our development builds. This obviously means we have a lot of artifacts building up.

So our aim was to use a post deploy powershell script to read the retention that would normally be applied on the tentacle and also apply it to our file server location.

So we were hoping for something that would tell us the “Keep N Days/Releases”. The OctopusRetentionPolicyItemsToKeep might work, is that a calculated value based on the configured keep N days/releases? i.e.

Keep last 4: OctopusRetentionPolicyItemsToKeep = 4
Keep last 3 days: Deploying twice a day OctopusRetentionPolicyItemsToKeep = 6

I realise this question is quite old now. However it would still be useful to us to know how this variable works.

Hi Sean,

Welcome back! The variables are pretty straight forward:

If you configure your retention policy to keep the last 4 packages, you’re gonna see the variable [OctopusRetentionPolicyItemsToKeep] with a value of 4

Now If you retention policy is set to keep the packages of the last 5 days, instead of the variable mentioned above, you’re gonna see the variable [OctopusRetentionPolicyDaysToKeep] with a value of 5

If you set the retention policy to “Keep all”, the variables wont show up on your deployment.

The retention policies use the file DeploymentJournal.xml that is sitting on the tentacle ( C:\Octopus\Applications[environmentname] on a default install) to evaluate what items should it delete.

Hope that helps

Dalmiro.

Hi Dalmiro,
Thank you very much! I think this will give me exactly what I want.

Sean Wisely
Analyst Programmer
T:0249219669 | F:0249219108 | Sean.Wisely@greater.com.au mailto:Sean.Wisely@greater.com.au

[Follow us on Facebook]http://www.facebook.com/GreaterBuildingSociety [Follow us on Twitter] https://twitter.com/GreaterBSociety [Follow us on Google+] https://plus.google.com/+GreaterBuildingSocietyLtd [Visit our YouTube channel] https://www.youtube.com/user/GreaterBuildingSoc [Visit our blog] https://www.greater.com.au/about/blog [Follow us on LinkedIn] http://www.linkedin.com/company/greater-building-society

[Greater Building Society]http://www.greater.com.au/
Greater Building Society
103 Tudor Street, Hamilton, 2303
T: 1300 651 400 | greater.com.auhttp://www.greater.com.au

CAUTION - This message may contain privileged and confidential information intended only for the use of the addressee named above. If you are not the intended recipient of this message you are hereby notified that any use, dissemination, distribution or reproduction of this message is prohibited. If you have received this message in error please notify the sender by return email. Any views expressed in this message are those of the individual sender and may not necessarily reflect the view of Greater Building Society Ltd. As email is transmitted over a public medium it is recommended that the recipient scan all emails with anti-virus software.

[2013 Awards Banner]

linkedin_icon.png

blog_icon.png

youtube_icon.png

facebook_icon.png

googleplus_icon.png

gbsawardemailbanner2013.png

twitter_icon.png

gbs-logo_2012.png