This guide will show you how to integrate Kiuwan into Team Foundation Server 2017.
Contents:
1. Install the KLA in the agent machines
See how to install KLA here: Install and Start Up Kiuwan Local Analyzer (KLA)
2. Select an existing project in TFS or create a new one
In TFS, every project must have one or more associated Version Control repositories. This way the build agents take care of extracting the source code automatically. In TFS 2017, the supported repositories are Git and TFS itself.
For existing projects, it is likely that the repositories are already configured and the code should be already there. For new projects, add your code to version control from Visual Studio.The repositories you configure here will be the ones that new Build definitions will use by default.
3. Configure a new build step
The new build step will run the Kiuwan analysis in a project's existing build configuration. It is possible to also create a new build configuration to include the Kiuwan analysis step.
Click the build definition edit link to add new build steps.
4. Define variables
In the Build Definitions settings screen, define two variables that will be available for the build agent at execution time, to hold the Kiuwan credentials necessary to run the analysis. To do this, first look for the variables section in the top Build definition sub-menu.
Click Add variable and give the new variables name such as KiuwanUser and KiuwanPasswd.
Click the lock icon to the left of the password variable value to hide it!
5. Configure a new build step
Go back to the Build Definition configuration page. Click Add build step... to configure a new build step.
Depending on the build definition template you selected to create your build, you will have some pre-configured build steps.
From the Task catalogue, in the Utility section, select the Command Line task.
6. Configure the command line task
Configure the command line task to run a Kiuwan analysis using the Kiuwan Local Analyzer CLI.
Title | Description |
---|---|
Name | Run Kiuwan Analysis (in this case) |
Tool | agent |
Arguments | -n $(System.TeamProject) -s $(Build.SourcesDirectory) -l "TFS build $(Build.BuildNumber)" --user $(KiuwanUser) --pass $(KiuwanPasswd) We are using System and Build predefined variables from TFS for the name of the application to analyze (it will be the project name), the directory where the source code is (it will be the checkout directory), and the label for the analysis (it will be the build number). Finally, we use the two variables we previously defined for the Kiuwan credentials. Using variables ensures consistency for every analysis and make them independent of the build agent machines that run them. |
Control Options | Continue on error = if checked, the build continues even if the analysis fails (the analysis could not run for some reason, it does not affect the results of 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.
7. Define triggers to run the build
The last thing is to define triggers to run the build on the project on given conditions.
The possibilities here are:
Description | Image |
---|---|
|
For testing purposes, click Queue new build… to run the build.
8. Run a build from Visual Studio and see the results
The configured build will trigger automatically after checking-in and committing changes to the project files from Visual Studio.
Once the check-in finishes in Visual Studio, go to TFS to confirm that the "Build and analyze with Kiuwan" build has been queued and is running:
To see the console output from the build agent and the progress of the different steps, click the build name in the table on the right.
After all the steps finished successfully, you can view the build definition summary with the results of the recent builds and more historical information.
Login to your Kiuwan account in the cloud to see the results of this build analysis.