I’ve searched the board for this question but surprisingly haven’t come up with the answer I’m looking for. I have a project with a multiple steps (i.e. packages) that I would like to install in the same directory. Right now the the packages are being installed as follows:
Ideally, in the future we’ll have a single install of the core code and all client code references the single install of core code but we’re not there yet. The core and client code need to be installed in the same location.
This will allow the contents of both packages to be copied to a single location.
However, this location won’t include the version number, so the files will be copied over the top of each other each deployment.
Another option would be to have Core installed to a single place (using OctopusPackageDirectoryPath), and then have a PowerShell script in the client code which manually copies the files from that location to the folder of the current Client package.
Assuming “Core” contains a set of DLL’s, it’s more common for people to simply bundle those DLL’s into the “Client” package, so that they are in the right location when Client is extracted. If you haven’t seen it already, there’s some more information on how Octopus expects NuGet packages to be structured here:
I’ve decided to use PowerShell to copy the core files to the client location as an interim solution until I can modify the NuGet package. Having a problem though. I have the following text in deploy.ps1.
copyCoreToClient
function copyCoreToClient
{
Write-Host “Copying core”;
}
I’m getting the following error:
The term ‘copyCoreToClient’ is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
Do I need to use an include file? I’ve set the execution policy to unrestricted.
My bad. I’m used to using PowerShell ISE. Anyway, you suggestion worked perfectly.
Another question. I’m using PowerShell to copy the Core code to the Client installation directory. Core and Client are two separate packages (i.e. steps). Deploy.ps1 is in the Client package. How can I get the path where Core was installed so I can copy the files to Client?
One option is to set OctopusPackageDirectoryPath on the Core project so that it is copied into a fixed folder path (e.g., C:\Core). Then you can reference that fixed path from the Deploy.ps1 in Client.
The other would be to ‘guess’ based on assumptions about where Octopus installs packages - e.g., something like this might work:
That said, this is all feeling a little complicated. Is it possible for you to include the assemblies of Core into the Client NuGet package? An application package really should contain all of the files needed to make the application run. After all I presume versions of Client make assumptions about the version of Core that is used?
I agree with your assertion our process was getting complicated. My team met and we’ve simplified the process tremendously. Core will now be installed to a single location on the server and the client code will reference the core code.
On that note. Should the $OctopusPackageDirectoryPath variable null/empty in PreDeploy.ps1 unless explicitly set? For example, the following returns “\Dev\GeneralHospital\2012.3.57.4311\content”. It should be “w:\websites\Dev\GeneralHospital\2012.3.57.4311\content”.
We are using octopus for several deployments in several environments. We have a unique code that has to be deployed in every environment. is there a way in octopus to deploy few files to one directory and few to other in the same server?