Cleaning content of a package pre-deploy

server
usability
known
(Kegulf) #1

Not sure if this is the right category, but it made the most sense in regards to what my problem is. Also, I’m quite new to Octo, so bear with me :smile:

tldr:

Can I delete files in package on Octo-server before deploying package to target-server?

We use Circle/CI for building our (React) web-app. The build produces a dist folder with subfolders pr. environment

simplified example:

dist
|__
   | - dev
   | - test
   | - prod

As of now we deploy the entire package to each env and set up a virtualDir that points to the correct env-folder on server.

What we would like to do is:

  1. Get package into Octo ( Step OK )
  2. Clean the package in pre-deploy to only contain the correct env-files ( NOT OK )
  3. Set new physical path for virtualDir ( Step OK )

I can not for the life of me figure out how to do the second step. Can’t seem to find anyone with a similar issue.

Is this even possible?

Can I delete files in the package before it’s deployed to the server?
We do NOT want to make several packages and send those to Octo.

(Paul Calvert) #3

Hi @kegulf,

Thanks for getting in touch!

When deploying the package it will always deploy the entire thing, there isn’t any way of choosing to only push certain folders.

I’ve tried to think of a way to achieve this, and the only one I can think of feels messy.
You could have a step that deploys/extracts on the Octopus Server or a shared location and then a second step to copy the contents of the required folder to the deployment target based on the environment. This does bypass the tentacle transfer mechanisms though.

Wish I had a better option for you.

Regards,
Paul

(Kegulf) #4

Hi Paul,

That’s too bad. We did consider the “via other server” approach, but as you say, it’s a bit messy :smile:

Originally we had a script to copy files from correct folder, then recursive delete all folders.

We did this on the target server. Thank God we put in some error checks, or the machine would’ve died :smile:

The solution will probably be to just leave all env-folders on each env-server. It’s not alot of bytes in total. Mostly my cleanliness-needs that I wanted to fulfill :grin:

Thanks for your reply anyways :blush:

(Paul Calvert) #5

To keep things a little tidier on the targets, you could have Octopus extract the package in the default directory (C:\Octopus\Applications) and then use a script to copy the required folder from there to where you want the virtualDir to run from.
Tentacle retention policies that are set within the lifecycle will keep the Applications folder from growing too large and the additional folders are kept separate from the virtualDir.