Hello, my team is using the “deploy a package” step to download and extract a ZIP file to a custom installation directory.
We would like to run a script against the ZIP file after it has downloaded from the remote repo, but before it is extracted.
The goal is to diff the files in the ZIP against files on disk, so we have a record of what file are changing and how.
Is this possible with a custom deployment script? (Focusing on getting the path to the ZIP before it’s extracted, and not worrying about the details of how to inspect its contents.)
Also are there any long-term plans to build in such a diff feature? It would be useful for config management, especially with a “dry-run” option to show you the diff without actually running it.
Thanks for your question.
Before I delve into a solution can I clarify where the ZIP that you want to inspect is stored?
When you say you’re using the deploy a package step, is the package indicated in that step the ZIP file that you want to compare, or is there another ZIP you download in the custom deployment script? You mentioned a remote repo so I just want to be sure I have the scenario clear in my head .
To answer your question about long-term plans to build a diff feature, as far as I know there are currently no plans to add this functionality, though I can see why that would be a useful option; a What-If? (or equivalent flag) would be a great way of ensuring the changes you expect to be made actually will before they do get made!
Currently we’re just fetching the ZIP from the Octopus Server (built-in) repo using the “deploy a package” step. So it has a version determined when you create a release or run a runbook.
It occurred to me we could extract to a temporary directory in “custom installation directory”, inspect there, then move them into the real directory in a post-deployment script? The pre-deployment script implies the ZIP has already been extracted (“after the package is extracted”)
That’s correct - and that was also why I asked the question if you were downloading the zip external to any package feed that Octopus was aware of. The reason being that Octopus will always extract packages before any scripts run (you can see the order features get run here).
And I think your solution of a temporary directory is probably the easiest way to solve the problem.
There are alternatives, but they all revolve around this theme; put the files in a folder to compare and then finish moving them afterward.
Thanks, that’s a useful link.
This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.