Calamari
Calamari copied to clipboard
Don't delete unextracted package files as part of lifecycle retention
Background
Since #team-fire-and-motion are adding package retention to workers we shouldn't need this functionality when the lifecycle retention policy gets applied as it will be moved to package retention. However, we do still want to clean up the ExtractedTo
directory where appropriate. This PR removes the functionality which removes package files stored on a tentacle/worker (ie. the package files now remain on the machine).
How to review
- Start Octopus server
- Create a Tentacle using the latest
main
branch fromOctopusTentacle
(or any version really) - Set up an external package feed
Library -> External Feeds
. I usehttps://www.nuget.org/api/v2
. - Add a "Deploy a package" step, for the package specify anything with multiple versions. I used
Newtonsoft.Json
. - Set the retention policy of the default lifecycle to keep 1 release.
- Create a release - for this release pick an older version of the package eg.
12.0.1
. Deploy the release. - Create another release - for this release pick the next version up eg.
12.0.2
. Deploy the release. - Create another release - for this release pick the next version up eg.
12.0.3
. Deploy the release. This release should contain a log that looks like the following:Note this is using an old version of Calamari. As you can see it removes both the
ExtractedTo
atC:\Octopus\Applications\<tentaclename>\Development\Newtonsoft.Json\12.0.1
and theDeployedFrom
atC:\Octopus\<tentaclename>\Files\[email protected]...
. - Pull this branch and build Calamari
- Run Calamari in your IDE with the following arguments and environment variables:
TentacleJournal=C:\Octopus\<tentaclename>\DeploymentJournal.xml
TentacleName=C:\Octopus\<tentaclename>
clean --retentionPolicySet "Environments-1/Projects-1/Step-Deploy a Package/Machines-61/<default>" --releases 1
You can find the retentionPolicySet
in DeploymentJournal.xml
at the home directory of your machine. It should look something like Environments-1/Projects-1/Step-Deploy a Package/Machines-1/<default>
.
11. The log should only say that it removed the ExtractedTo
contents with no mention of the DeployedFrom
. Check the Files
directory of your tentacle and [email protected]
should still be there.
The tests have been changed as well to account for the fact that packages aren't being deleted anymore. I think this makes sense for RetentionPolicyFixture
since removing packages won't be its responsibility anymore. Not as sure about CleanFixture
though but the same logic applies - it won't be dealing with packages anymore.
When do we want to remove the existing retention logic?
Not sure, maybe this one should be merged when everything else package retention related has been merged? @MissedTheMark
Yeah, definitely not yet 😅 We'll hold off on this until the rest is done.
@N-lson does this still need reviewing?
Not sure. @tothegills do you know?