Managing your Differential Analysis for CI/CD pipelines
Differential Analysis builds a report on new issues with respect to a reference project analysis loaded with kwadmin. Typically, the Differential Analysis is performed on a subset of an application (for example, a changeset) to detect issues within the selected files.
Just like you manage your reference project analysis results using the Builds tab, you can manage your differential analysis for CI/CD pipelines using the CI Builds tab in the Validate Portal. Running a CI build enables you to see your issues before running a server build, and manage these issues in the same ways as your server issues. You can run kwciagent to sync your issues to Validate. This enables you to catch your issues much faster then if you were to run a full build. It works side-by-side with your server build, and you can also integrate it with your preferred testing tool(s) such as Jenkins.
Restriction: CI builds do not work with grouping enabled.
Creating a CI build using kwciagent
In order to have access to the CI Build tab, you first need to create a continuous integration job to perform a differential analysis using kwciagent, as follows:
- First, generate a build specification for your project using kwinject.
kwinject make
- Next, add the build specification to the kwciagent folder:
kwciagent create -b kwinject.out --url http://localhost:8080/myproject
- Create a list of changed files. For example, if you are using git, you can collect a list of file paths (relative or absolute) to the files changed in the analysis:
git diff --name-only origin/master > diff_file_list.txt
- Lastly, run the Differential Analysis (kwciagent run) on the changed files. Specify --ci-build to load the results to the portal:
kwciagent run –-ci-build ci_build_1 @diff_file_list.txt
Editing your CI build name
To edit the details of a particular CI build, select the pencil icon. From this dialog, you can edit the name of your CI build. The build name must start with a letter or number, and can be no longer than 64 characters. Period (.), minus sign (-), ampersand (&), white space, and underscores are allowed.
Restriction: We recommend that you do not give your CI builds fully numerical names.
Deleting a CI build
To delete a CI build, select the trash can icon. Once a CI build has been deleted, it cannot be recovered; only delete CI builds you are certain are no longer needed.
Filtering your CI build list
You can use the search bar at the top of the CI builds page to filter your CI build list. This can be helpful if you have a long list of CI builds and need to filter the list by a particular build. For more information about searching, see Searching in Validate by Perforce.
Managing issues found in CI builds
You can manage new issues introduced in your CI analysis via a build in your continuous integration environment in the same way you would handle these issues when found in your server build. You can fix, cite, or defer issues as you see fit, and re-rerun your build to ensure they are no longer reported or have been fixed as you would expect. For more information on how to manage your issues, see Investigating issues.
You can also use the Web API to get CI issue details, manage your CI builds, and more. For examples, see our Issue and metric API examples.