Continous Integration

Continuous Integration (CI) is the process of taking features from the Program Backlog and developing, testing, integrating, and validating them in a staging environment where they are ready for deployment and release.

Traditional software development methods don’t dictate how frequently or regularly you integrate all of the source on a project. Programmers can work separately for hours, days, or even weeks on the same source without realizing how many conflicts (and perhaps bugs) they are generating. Agile teams, because they are producing robust code each iteration. Here i am going to discuss about Jenkins and Octopus deployment for the CI Integration.

Jenkins is an extendable, open-source continuous integration server. You can use Jenkins to compile and test your code, and then have it trigger deployments.

There are some plugins that are needed to work for contionus integration using jenkins.

  • MSBuild Plugin – required to compile your Visual Studio solution

C:\Program Files (x86)\Jenkins\workspace\…sln

  • GIT Plugin and other (required if using GIT)

During our Jenkins job, we will:

  1. Compile the code, run unit tests, and so on – typical CI tasks
  2. Have OctoPack create NuGet packages
  3. Publish these NuGet packages to the Octopus Deploy Server
  4. Create a release in Octopus, ready to be deployed

Jenkins uses the MSBuild plugin to compile Visual Studio solutions. Once OctoPack has been installed on your  projects, you can configure Jenkin’s MSBuild task to pass the appropriate parameters to MSBuild to have OctoPack run.

The settings :

  • RunOctoPack: specifies that OctoPack should create packages during the build
  • OctoPackPackageVersion: version number that should be given to packages created by OctoPack. Since Jenkins build numbers are integers like “12”, we combine it with “1.1.” to produce package versions such as “1.0.12”.
  • OctoPackPublishPackageToHttp: tells OctoPack to push the package to the Octopus Deploy Server. Read more about the built-in NuGet repository in Octopus. You’ll find the URL to your repository on the Library ➜ Packages tab in Octopus. Simply click the Show examples link to see options to upload packages including the repository URL.
  • OctoPackPublishApiKey: your Octopus Deploy API key

Jenkins is compiling our code and publishing packages to Octopus Deploy. If we wish, we can also have Jenkins automatically create (and optionally, deploy) a release in Octopus.

To do this, we’ll be using the Octo.exe command line tool. Download Octo.exe, and extract it to a folder on your Jenkins server, such as C:\Tools\Octo\Octo.exe

We can call Octo.exe easily using the Jenkins Execute Windows batch command task.

Commands: “C:\Tools\Octo\Octo.exe” create-release –project OctoFX –version 1.1.%BUILD_NUMBER% –packageversion 1.1.%BUILD_NUMBER% –server http://localhost/ –apiKey %OctopusApiKey% –releaseNotes “Jenkins build [%BUILD_NUMBER%](http://localhost:8054/job/OctoFX/%BUILD_NUMBER%)/”

 

Deploying releases

“C:\Tools\Octo\Octo.exe” create-release ….(same as before)… –deployto=Development –progress

C:\Tools\Octo\Octo.exe create-release –project RBlogRR –deployto Production –server http://localhost:8081/ –apiKey API-sdfsdfsdffsdf –progress

 

Now there should be some settings needed on octopus as well:

Install Octopus Deploy

Install Tentacles

Tentacle is a job runner. It waits for Octopus to give it a job (deploy a package, run a script), and it executes it, reporting the progress and result back to the Octopus server. [1]

Create Environments

Click environments tab and create environments as DEV, TEST, STAGE,PROD.

You should also configure required fields in environment edit page and save the correct tentacle ID.

Go to the server where tentacle manager installed. This is the server that we will going to deploy the packages.

Then, we will paste that tentacle ID in test target machine.

Add Project

Set your project’s Package ID

Set your web.config values and variables for each environment.

 

Add a Comment

Your email address will not be published. Required fields are marked *