Deploy libraries that are dynamically loaded separately from the main deploy package step.

Andrei Scutariu's Avatar

Andrei Scutariu

16 May, 2017 12:23 PM

Hello,
We have Octopus projects that deploy octopacked nuget packages (using deploy nuget package step). The package contains a windows service which is installed, then started in a later step.
The application that is deployed supports dynamically loading libraries. On some environments we want the libraries to be deployed (and so loaded) in others they should not be deployed.
What is the best approach to do this?
Ideally we would also like to make use of the Skip any package step that is already installed feature to keep the overall deploy time as low as possible.
Thank you,
Andrei Scutariu

  1. Support Staff 1 Posted by Kenneth Bates on 17 May, 2017 06:13 AM

    Kenneth Bates's Avatar

    Hi Andrei,

    Thanks for getting in touch! The best approach is to have two package steps, one being your packaged libraries. You can specify which environment this package step should be run in by using the Run only for specific environments option in your package step's Conditions section (refer to my attached screenshot showing this option). That will force this step to only deploy this package when deploying to one of your selected environments.

    I hope this helps! Let me know if you have any further questions.

    Best regards,

    Kenny

  2. 2 Posted by Andrei Scutariu on 17 May, 2017 07:49 AM

    Andrei Scutariu's Avatar

    Hi, thank for your answer. I have two new question.

    1. How do you recommend deploying the binaries from the second package into the directory of the first package? (Currently we use Custom install directory on the packaged libraries step).

    2. How this will behave when using "Skip any package step that is already installed feature". The version of both packages (main and libraries) are changed differently.
    [Scenario]" If the version of first package is changed and the version of the libraries doesn't, the libraries packages is not deployed, therefore the libraries are not deployed in the first package.

    What is your recommendation of using "Skip any package step that is already installed feature" in this situation.

    Thank you.

  3. Support Staff 3 Posted by Kenneth Bates on 19 May, 2017 05:01 AM

    Kenneth Bates's Avatar

    Hi Andrei,

    That's no problem! Thanks for following up. Based on what you've described, I would recommend using an output variable to define the path. Output variables are created during your deployment process, and they can be used in subsequent steps in your deployment process. You can refer to our documentation for additional information: https://octopus.com/docs/deploying-applications/variables/system-va...

    Specifically in your scenario, when your first package step runs, an output variable is created for the installation directory for this package. This variable is Octopus.Action[YourStepName].Output.Package.InstallationDirectoryPath, and using it allows you to define the directory in which your 2nd package will install to be the same directory as your first package. Refer to my attached screenshot showing this variable being used as the custom install directory on my second package step.

    Keep in mind that this output variable will not be available if the first package step is skipped as it is only created when that step runs. So it will require both of your package steps to be run on each deployment.

    Alternatively, you can use a postdeploy PowerShell script to copy the files. A postdeploy script can be included in your package, in which Calamari will detect and invoke it. You can also define a postdeploy script in your package step using the Custom deployment scripts feature. Refer to our documentation here for more info on this option: https://octopus.com/docs/deploying-applications/custom-scripts#Cust...

    I hope this helps! Let me know if you have any further questions.

    Best regards,

    Kenny

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac