Run Script After Creating Offline Package Drop

We are interested in running a script after the creation of an Offline Package Drop. What is the best way to do this? We don’t see any hooks in the Offline Package Drop process, nor does the Script Console seem to have what we want.

An example use case would be to upload the file drop to a secure location or perform other actions on the files.

Greetings WG! By default, Octopus Deploy will pick up embedded script files and execute them during the deployment process. In addition, steps like Deploy a Package can be configured to run inline scripts. To do this, edit the Deploy a Package step, click Configure Features and enable the Custom Scripts feature

Hope this helps!

Thanks for the response, but this not during Deployment. This is just after the creation of the offline drop files, not Deployment when the offline deployment script is run.

We are quite familiar with how to script during the deployment process, but we need a way to execute a script as part of the post process of creating the offline package itself.

Ah! Okay, thank you for clarifying :slight_smile: If I may ask, what type of things are you needing to do at that time?

An example use case would be to upload the file drop to a secure location or perform other actions on the files, like generating hashes.

You should be able to do this using a Worker that has access to the file share.

OK, could you please explain the steps in a little more detail?

How about this use case:
I would like to run a powershell script that copies the resultant drop folder that is created.

So I would need the Offline Package Drop process to pass the folder name to the script when it executes it. How would this be done?

Thank you.

I played around with this scenario on my local instance this morning to see if the location is available as a variable during the deployment process. Since the offline package drop isn’t actually deployed, none of the variables contained it’s destination. However, we can infer the destination using the documentation https://octopus.com/docs/infrastructure/deployment-targets/offline-package-drop#drop-folder-destination, that could be set as a variable in your project that the worker could then use.

OK. So I’ve created a worker and a worker pool on an external server using a tentacle. But now how do I configure it to run after the Package Drop is created? It’s not clear to me how this will be called after the directory is created. Could you please explain in more detail?

Thank you.

Absolutely! Here is a screen shot as to what my process looks like (ignore step 2, I was doing something else)

My offline drop is configured to go to my file server on my local network. Once it’s placed there, step 3 is able to access the same location

Get-ChildItem -Path “\\octopusdeploy\offlinedrop”

Should be able to do the file manipulation at this point :slight_smile:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.