Jenkins Octopus integration

Hi,
I was going through the documentation for jenkins and octopus integration.
I want to

  1. Build the package
  2. Run Unit tests
    Then,
    send the nuget package octopus server
    Finally,
    DO a deployment to various environments and machines.

Can you please help me with steps or resources for effectively performing the above process in jenkins for octopus. Appreciate your help. thanks.

Hi,

I assume you’ve looked at Octopack and it’s package upload ability however you only want to upload the package when your tests pass. There are a few ways we can go about doing this.

  1. Run the tests as a post build step and fail MSBuild if they don’t all pass.
  2. Build with Octopack, runs the tests, then use Nuget to push the package if the tests pass.

I’ll describe option two a bit more, and make use of the appropriate Jenkins plugins (Although you could do the same thing entirely in nant, cake, psake, or msbuild).

We’ll split up the project configuration into three parts.

Building the project

Build the project as per normal, the MSBuild plugin will let you build the solution file. You’ll also want to run OctoPack.

/p:Configuration=Release;RunOctoPack=true

Running the tests

Jenkins has a plugin for most unit test frameworks. If you’re tests fail by default Jenkins won’t continue.

Pushing the package

Create an execute shell build step and call Nuget push.

NuGet.exe push <YourApp.nupkg> -ApiKey <Your API Key> -Source https://YourOctopusDeploy/Nuget/packages

The steps to make a deployment are detailed in the Jenkins documentation page. you may also want to refer to the complete documentation for the Octopus command line tool .

If you need any extra flexibility everything Octopus Deploy can do is also available via the API. To automate deployments you need to first create a release and then deploy the release. If you can’t figure out the exact body or parameters remember you can use the developer tools to see what the Octopus UI does and copy that.

Hope that helps!

Daniel