Manage 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).
In this topic:
Create 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
Edit 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.
Delete 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.
Filter 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.
Configure and set a CI Quality Gate
The CI Quality Gate allows you to define criteria that determine whether a CI build passes or fails based on the issues it contains.
You can configure the Quality Gate at the project and stream level in Validate:
-
Go to Project or Stream > CI Builds.
-
In the Quality Gate field under the Search bar, define your queries using the same search syntax used on the Issues page (for example, taxonomy filters, status filters and reference filters).
-
Use the pencil icon to edit the Quality Gate value.
-
Run
kwciagent run --ci-build. -
If set, the Quality Gate status and information display under relevant builds.
Additionally, when you click on any CI build, the right-hand panel displays the applied Quality Gate value along with a link. Selecting this link opens the Issues page, where you can view all failures associated with that Quality Gate.
Notes:
-
Configuring CI Quality Gate requires project admin permissions.
-
The default value for CI Quality Gate is empty.
-
Streams inherit from the base project until manually overridden.
Manage 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.