TeamCity quick start guide
TeamCity is a commercial build server application that provides continuous integration, reporting, and parallel software builds. You can integrate your Klocwork analysis build with a TeamCity server to combine each of these features with your Klocwork analysis. This example assumes that you have already created a TeamCity project and that you may or may not have active build configurations. Each TeamCity build configuration defines the settings for your build. This includes the build step, which defines the build runner type, along with build file path information, project information, build triggers, failure conditions and build parameters. For more information about creating your build configuration, refer to the TeamCity documentation. Create your project/build configurationIf you haven't already, create your project in TeamCity. Next, create your build configuration as you normally would, taking care to specify the details of your build. Then, as part of your build configuration, you must perform the following step:
Enable Klocwork Static Analysis on your projectTeamCity uses build agents to perform build operations. You can use multiple build agents to perform many builds in parallel. The build agent typically checks out the source code, initializes the build environment, and runs the software build. You must configure each build agent that will be used to perform Klocwork analysis. The Klocwork Static Analysis build step automatically wraps your existing build steps with the necessary commands to run analysis. The analysis step itself has an option to ignore build steps if you do not want those steps included.
You can synchronize custom checkers from your server to your TeamCity build agents by using kwdeploy. The kwdeploy executable can be found on your build agents in the following location: <teamcity_build_agent_root>\tools\klocwork\<platform>\bin\kwdeploy.exe For example: <teamcity_build_agent_root>\tools\klocwork\windows\bin\kwdeploy sync --url http(s)://<Klocwork_host>:<port> Enable build failureIf you want your builds to fail when any new defects are found, you can add a build parameter in TeamCity that will mark a build as failed if defects are discovered during analysis. The following image shows an example of TeamCity configured to fail the build if the JSON file includes one or more new issues. The detected issues will include any new issues since the last build and the issues from all failed builds since the last successful build. If you choose not to fail the build, then the issue list will contain only the issues detected in the latest build. ![]() Run a build and verify the results in KlocworkYou can verify your integration by running a build and checking the JSON output in TeamCity:A new build is created each time Klocwork performs an analysis.
Note: The first analysis run sets the baseline and therefore no results are shown. New and fixed issues are shown for subsequent builds.
Additional steps are required to access your issues in one of our supported IDEs, as follows:
Note: When citing issues, if there is a local issue that maps to the same defect as the imported one, the citing information is not merged. Citing a server issue modifies the status on the server only; the citing information is updated after the next CI build.
|