Automating Deployment using FAKE and Octopus Deploy
INFO
This documentation is for FAKE version 5.0 or later. The old documentation can be found here
Octopus Deploy is a great tool for simple and user-friendly release management.
Installing Octopus Deploy
You can try the cloud version of Octopus here. Otherwise you can download it from http://octopusdeploy.com/downloads - and then start a free trial. Then follow the Installation Instructions to get yourself up and running.
You will also need to install and configure at least one Tentacle which you will deploy your software and services to.
Octo.exe CLI tool
This module is a wrapper around the Octo.exe CLI tool which controls Octopus Deploy API. You'll need the Octo.exe tool itself accessible to your FAKE script. Download it from here.
This module also supports use via a .NET Core Tool-Manifest. Installation is simple! From the root of your repository run the following
1: 2: |
|
Generate an API Key
In order to communicate with the Octopus Deploy API you will need an API key to authenticate with.
It is a good idea to create an account in Octopus Deploy for your Continuous Integration systems (eg: TeamCity) - and then generate a new API key for that account, that can be safely used from within your build process.
Define common options
You can define a function defining shared parameters like ToolPath
or your Octopus Deploy instance details. Then the function can be used in subsequent Octo
calls.
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: |
|
Push a package
Packages can be pushed to the built-in Octopus repository with the push command:
1: 2: 3: 4: |
|
Create a Release
Octopus Deploy relies on the concept of a release, which should be an immutable NuGet Package which has been built, tested, packaged and published from your Continuous Integration systems - which you can of course completely manage with your FAKE script.
So once you have created a project you are able to create and push a release into Octopus Deploy. This can be done through the Octopus UI, command line tool, or in our case - from a FAKE script.
1: 2: 3: 4: 5: 6: |
|
Deploy a Release
You can automatically deploy a release when you create it, but using the optional deploy options when you create your release.
This is often a good idea when you want your FAKE build script to continue on to a second set of perhaps slower, unit tests that exercise behaviors in a more complete and perhaps integrated environment.
1: 2: 3: 4: 5: 6: 7: |
|