Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Info
titleContents

Table of Contents

Everybody knows the benefits of CI in the SDLC. I’m not discovering new ground here, but what’s interesting is that you can leverage your continuous integration processes to have a continuous analysis processes to have all the objective information you need from your applications at build time with Kiuwan.

...

Run a Kiuwan analysis from a TeamCity build step-by-step

Install the KLA in the agent machines.

Installing the KLA is pretty simple and straightforward, just take the KiuwanLocalAnalyzer.zip downloaded directly from your Kiuwan account and unzip it in a directory of your choice. That directory /KiuwanLocalAnalyzer will be your Kiuwan home (sometimes we call it agent home, to avoid confusion with the TeamCity agent I’ll stick to Kiuwan home). In Windows machines the KLA installation is done. For unix based machines there are a couple of little things to do:
Go to your directory and run a chmod command for all *.sh files to add execution permission (find -name “*.sh” -exec chmod +x {} \;)
Now, go to /bin directory and create a symbolic link named agent pointing to agent.sh (ln -s agent.sh agent).
To be able to invoke the KLA CLI in every machine without the installation path, add the /bin directory to the system path.

 Create or edit a TeamCity project

Select an existing project in TeamCity or create a new one. In TeamCity every project has one or more Version Control System (VCS) associated to it. This way the agent build agents take care of stracting extracting the source code automatically. The VCS could be basically any: SVN, Git, GitHub, BitBucket, TFS, etc.

Configure an analysis step in a build configuration

The next step is to configure a new build step that will run the Kiuwan analysis in a project existing build configuration, or create a new build configuration to include the Kiuwan analysis step.

...

Click create build configuration or edit an existing one in the general project settings page.

Define Kiuwan credentials variables

In the build configuration settings screen, the first thing to do is to define a couple of variables that will be available for the build agent at execution time to hold your Kiuwan credentials necessary to run the analysis. Look for the parameters section in the left menu.

...

Now you have to define 2 system level variables: system.kiuwan.user y system.kiuwan.password. This last one you can set it to be of type password so it is never displayed.

Define the analysis step itself

Next, in the build configuration settings screen you have to go to the build steps configuration and create a new one to set up the analysis.

...

This configuration will run a Kiuwan Baseline analysis. If you want to run a delivery analysis for a change request you can define another build configuration where the analysis step will have extra parameters for the KLA agent to run a delivery analysis. Refer to the Kiuwan Local Analyzer documentation for more information on the available parameters. 

Define a build trigger

The last thing is to define a trigger to run the build on the project on given conditions. The typical ones will be to run a build when changes are committed to the VCS or run it periodically based on a defined schedule. TeamCity has a nice feature allowing you to run it periodical but only if there are committed changes in your VCS. That’s what I’ve done.

...

When it finishes, you can see the final result of the execution and you have a link to access the analysis results in Kiuwan.

See the results in Kiuwan

Clicking the link will open your default browser and take you directly to the results summary page.

...