The following plugin provides functionality available through Pipeline-compatible steps. Read more about how to integrate steps into your Pipeline in the Steps section of the Pipeline Syntax page.

For a list of other such plugins, see the Pipeline Steps Reference page.

Klocwork Analysis Plug-in

klocworkBuildSpecGeneration: Klocwork - Step 1 (CI/Full) - Capture Build Information

  • buildSpecConfig
      Nested Object
    • buildCommand : String
      Specify your project's build command. This command is used to compile the project and capture information about the build in a build specification file that Klocwork will use for the analysis.
    • tool : String
      The Klocwork tool used to generate the build specification, by default this is set to kwinject.
      Tools Available: kwinject monitors your C/C++ build to create a build specification kwmaven creates a Java build specification based on the information in your maven build file kwmavenw creates a Java build specification based on the information in your maven wrapper file kwjsspec creates a Javascript build specification file kwpyspec creates a Python build specification file kwktspec creates a Kotlin build specification file kwant creates a Java build specification based on the information in your ant build file create tracefile uses kwinject to create a trace file, mainly used for debugging kwgradle creates a Java build specification based on the information in your Gradle build file kwgradlew creates a Java build specification based on the information in your Gradle wrapper file
    • output : String
      Specify the build specification output filename and, optionally, its file path. By default, the build specification is written to kwinject.out in the current working directory. The specified file path can be absolute or relative to the current working directory. By default, the current working directory is the workspace directory.
    • additionalOpts : String
      Specify other tool options here. Separate the options with whitespace; surround any arguments with whitespace in double quotes.
    • ignoreErrors : boolean
      Ignore any error return codes from this step and continue.
    • workDir : String (optional)
      Specify the working directory path from where the Klocwork Build Spec Generation command will be executed. This path must both exist and be relative to the workspace directory. If no value is specified in this field then the Klocwork Build Spec Generation command will be executed from the workspace directory.

klocworkFailureCondition: Klocwork - Post Analysis (Full/CI) - Build Failure Conditions (Optional)

  • failureConditionConfig
      Nested Object
    • enableServerFailureCondition : boolean (optional)

      Full integration analysis build failure conditions (Full)

      Create multiple build failure conditions by using queries that are sent to the Klocwork Server through the Web API.

      Filter issues based on the search query, then provide the status to set the build to, along with the threshold (the number of issues to meet this criteria).

      Note: unless specified, the query runs with issue grouping turned off (grouping:off).

    • failureConditionServerConfigs (optional)
        Array / List of Nested Object
      • jobResult : String
      • query : String
      • threshold : String
      • conditionName : String
      • stopBuild : boolean
      • enableHTMLReporting : boolean
    • enableCiFailureCondition : boolean (optional)

      Differential analysis build failure conditions (CI)

      Set a threshold for the differential analysis build failure conditions. Pass the build if the threshold is not exceeded; fail otherwise.

      This step checks the XML report generated by the differential analysis build step. You can filter which issues appear in this report by providing additional options to the differential analysis build step.

      This step counts the total number of issues in the XML report.

    • enableDesktopFailureCondition : boolean (optional)
    • failureConditionCiConfig (optional)
        Nested Object
      • withDiffList : boolean
      • diffFileList : String
      • threshold : String (optional)
      • reportFile : String (optional)
      • enableHTMLReporting : boolean (optional)
      • enabledSeverites (optional)
          Nested Object
        • critical : boolean
        • error : boolean
        • warning : boolean
        • review : boolean
        • fiveToTen : boolean
      • enabledStatuses (optional)
          Nested Object
        • analyze : boolean
        • ignore : boolean
        • notAProblem : boolean
        • fix : boolean
        • fixInNextRelease : boolean
        • fixInLaterRelease : boolean
        • defer : boolean
        • filter : boolean
      • failUnstable : boolean (optional)
      • name : String (optional)
      • stopBuild : boolean (optional)
    • failureConditionCiConfigs (optional)
        Array / List of Nested Object
      • withDiffList : boolean
      • diffFileList : String
      • threshold : String (optional)
      • reportFile : String (optional)
      • enableHTMLReporting : boolean (optional)
      • enabledSeverites (optional)
          Nested Object
        • critical : boolean
        • error : boolean
        • warning : boolean
        • review : boolean
        • fiveToTen : boolean
      • enabledStatuses (optional)
          Nested Object
        • analyze : boolean
        • ignore : boolean
        • notAProblem : boolean
        • fix : boolean
        • fixInNextRelease : boolean
        • fixInLaterRelease : boolean
        • defer : boolean
        • filter : boolean
      • failUnstable : boolean (optional)
      • name : String (optional)
      • stopBuild : boolean (optional)
    • failureConditionDesktopConfig (optional)
        Nested Object
      • withDiffList : boolean
      • diffFileList : String
      • threshold : String (optional)
      • reportFile : String (optional)
      • enableHTMLReporting : boolean (optional)
      • enabledSeverites (optional)
          Nested Object
        • critical : boolean
        • error : boolean
        • warning : boolean
        • review : boolean
        • fiveToTen : boolean
      • enabledStatuses (optional)
          Nested Object
        • analyze : boolean
        • ignore : boolean
        • notAProblem : boolean
        • fix : boolean
        • fixInNextRelease : boolean
        • fixInLaterRelease : boolean
        • defer : boolean
        • filter : boolean
      • failUnstable : boolean (optional)
      • name : String (optional)
      • stopBuild : boolean (optional)

klocworkIncremental: Klocwork - Step 2 (CI) - Run Differential Analysis

  • ciConfig
      Nested Object
    • buildSpec : String
      Build specification to use for analysis. Path is relative to the workspace
    • projectDir : String
    • cleanupProject : boolean
    • reportFile : String
      XML report file in which to store Klocwork results. Optional, in case you want to use the XML report for something custom; otherwise, a default file is created for the post-build step.
    • additionalOpts : String
      Additional options added to the kwciagent run command. For example, specify the number of jobs/threads to use (--jobs-num) or which filters to apply (--severity --taxonomy --system)
      See the Klocwork documentation for more information.
    • incrementalAnalysis : boolean

      Analyze changed files only

      This feature allows for quick, incremental analyses of changed source files to enable pre/post-checkin/commit-like behavior . The goal is that only changed files are analyzed by the Klocwork kwciagent tool to replicate the local analysis developers would perform by using our supported IDE plugins or the command line utility. To enable this behavior, the plugin takes a list of the changed files from the SCM; this enables the system to analyze only the changed files when the workspace isn’t kept. Leave this cleared to analyze the whole project, or, if the workspace is kept, to perform a standard incremental analysis.

      Diff file list

      The diff file list is the file that contains the changed source files for Klocwork to analyze. All analyzed files must exist in the build specification generated by kwinject.

      Note: All files to be analyzed must exist in the build specification.

      Using Git

      If using Git, provide the previous commit that Git should perform a "diff" against. The change list between the current commit and the specified previous commit will be added to the diff file list for Klocwork to process by automatically calling "git diff <previous_commit>" during the build. Note: If you are using Git jenkins plugin to obtain source files for you pipeline job be sure to use 'Pipeline script from SCM' and specify the previous commit with the environment variable, 'GIT_PREVIOUS_COMMIT'. Also be aware that the first build in the job won't be able to access GIT_PREVIOUS_COMMIT and the first build will run full CI analysis.

      Manual

      If you are not using Git, or want to manually generate the change list by using Git, select this option. You will need to generate the diff file list by using a custom build-step (or similar). List one changed source file on each line of the file.

    • differentialAnalysisConfig
        Nested Object
      • diffType : String
      • gitPreviousCommit : String
      • diffFileList : String

klocworkIntegrationStep1: Klocwork - Step 2 (Full) - Run Analysis

  • serverConfig
      Nested Object
    • buildSpec : String
      Build specification to use for analysis. Path is relative to the workspace.
    • tablesDir : String
      Specify the location of the tables directory, for example, ${MY_VAR}/kwtables.
    • incrementalAnalysis : boolean
    • ignoreCompileErrors : boolean
      Ignore compile errors encountered by kwbuildproject. This setting will not ignore a return code that indicates that kwbuildproject failed to the extent that no results are generated.
    • importConfig : String
      Optionally, provide configuration files to import to the project before running the analysis. If the checker configuration (for example, analysis_profile.pconf) is under version control, you can provide the file here and it will be automatically imported for each build.
      Specify multiple files by separating them with commas (",").
    • additionalOpts : String
    • disableKwdeploy : boolean
      By default, kwdeploy runs before the analysis, to ensure the checkers are up-to-date. Enable this setting if you don't want kwdeploy to run before the analysis.
    • duplicateFrom : String (optional)
      Optional setting to specify the name of an existing Klocwork project. Klocwork will duplicate that project's configuration settings.
    • enabledCreateProject : boolean (optional)
      Enable to create a new Klocwork project on the server if one does not exist with the name specified. This can be useful when using multi-branch pipeline jobs.

klocworkIntegrationStep2: Klocwork - Step 3 (Full) - Load Analysis Results

  • serverConfig
      Nested Object
    • tablesDir : String (optional)
    • buildName : String (optional)
      Specify the name of the build for the Klocwork server, for example, ${MY_VAR}-${GIT_COMMIT}. If empty, Klocwork uses an auto increment to name the builds.
    • additionalOpts : String (optional)
  • reportConfig (optional)
      Nested Object
    • displayChart : boolean
    • chartHeight : String (optional)
    • chartWidth : String (optional)
    • query : String (optional)

klocworkIssueSync: Klocwork - Post Analysis (Full) - Cross-Project Issue Sync (Optional)

  • syncConfig
      Nested Object
    • dryRun : boolean
      Cross synchronisation reads and writes to the Klocwork database. Therefore, we strongly recommend that you first try a Dry Run of the command (which skips the writing) and verify that the command works as expected.
    • lastSync : String
      Specify the "last synchronisation" date (how far back Klocwork should go when synchronising issue citations).
      Format is "DD-MM-YYYY hh:mm:ss".
      For example, "03-00-0000 00:00:00" will go back 3 days in time.
    • projectRegexp : String
      A regular expression that is used to retrieve Klocwork projects that should be processed during synchronisation. If you want to process all projects, leave empty.
      For example, if you prepend projects with "DEPT-" to indicate a particular department the regular expression "^DEPT-" will match all these projects
    • statusAnalyze : boolean
    • statusIgnore : boolean
    • statusNotAProblem : boolean
    • statusFix : boolean
    • statusFixInNextRelease : boolean
    • statusFixInLaterRelease : boolean
    • statusDefer : boolean
    • statusFilter : boolean
    • additionalOpts : String
      Additional options added to the kwxsync command.
      See the Klocwork documentation for more information.

step([$class: 'KlocworkBuildSpecBuilder']): Klocwork - Step 1 (CI/Full) - Capture Build Information

Integration analysis (Full)

Use the following steps to perform a Klocwork integration analysis and load the results to the Klocwork Server:

Klocwork - Step 1 (CI/Full) - Capture Build Information runs a Klocwork build specification generation tool to capture compilation information about the project Klocwork - Step 2 (Full) - Run Analysis runs the Klocwork Server analysis engine against the data captured within the build specification Klocwork - Step 3 (Full) - Load Analysis Results runs the Klocwork Server load tool, which imports analysis data into the Klocwork Server database

Differential Analysis (CI)

Use the following steps to perform a differential analysis, which does not publish the results to the Klocwork Server and only reports the new issues detected since the previous integration analysis. Differential analysis can be used as a quality measure to reduce new issues being added to the Klocwork Server, and can also be configured to only analyze the changed files from the checkin, making the process much quicker:

Klocwork - Step 1 (CI/Full) - Capture Build Information runs a Klocwork build specification generation tool to capture compilation information about the project Klocwork - Step 2 (CI) - Run Differential Analysis runs an analysis only on the changed files by using the Klocwork command line user tool
  • buildSpecConfig
      Nested Object
    • buildCommand : String
      Specify your project's build command. This command is used to compile the project and capture information about the build in a build specification file that Klocwork will use for the analysis.
    • tool : String
      The Klocwork tool used to generate the build specification, by default this is set to kwinject.
      Tools Available: kwinject monitors your C/C++ build to create a build specification kwmaven creates a Java build specification based on the information in your maven build file kwmavenw creates a Java build specification based on the information in your maven wrapper file kwjsspec creates a Javascript build specification file kwpyspec creates a Python build specification file kwktspec creates a Kotlin build specification file kwant creates a Java build specification based on the information in your ant build file create tracefile uses kwinject to create a trace file, mainly used for debugging kwgradle creates a Java build specification based on the information in your Gradle build file kwgradlew creates a Java build specification based on the information in your Gradle wrapper file
    • output : String
      Specify the build specification output filename and, optionally, its file path. By default, the build specification is written to kwinject.out in the current working directory. The specified file path can be absolute or relative to the current working directory. By default, the current working directory is the workspace directory.
    • additionalOpts : String
      Specify other tool options here. Separate the options with whitespace; surround any arguments with whitespace in double quotes.
    • ignoreErrors : boolean
      Ignore any error return codes from this step and continue.
    • workDir : String (optional)
      Specify the working directory path from where the Klocwork Build Spec Generation command will be executed. This path must both exist and be relative to the workspace directory. If no value is specified in this field then the Klocwork Build Spec Generation command will be executed from the workspace directory.

step([$class: 'KlocworkCiBuilder']): Klocwork - Step 2 (CI) - Run Differential Analysis

  • ciConfig
      Nested Object
    • buildSpec : String
      Build specification to use for analysis. Path is relative to the workspace
    • projectDir : String
    • cleanupProject : boolean
    • reportFile : String
      XML report file in which to store Klocwork results. Optional, in case you want to use the XML report for something custom; otherwise, a default file is created for the post-build step.
    • additionalOpts : String
      Additional options added to the kwciagent run command. For example, specify the number of jobs/threads to use (--jobs-num) or which filters to apply (--severity --taxonomy --system)
      See the Klocwork documentation for more information.
    • incrementalAnalysis : boolean

      Analyze changed files only

      This feature allows for quick, incremental analyses of changed source files to enable pre/post-checkin/commit-like behavior . The goal is that only changed files are analyzed by the Klocwork kwciagent tool to replicate the local analysis developers would perform by using our supported IDE plugins or the command line utility. To enable this behavior, the plugin takes a list of the changed files from the SCM; this enables the system to analyze only the changed files when the workspace isn’t kept. Leave this cleared to analyze the whole project, or, if the workspace is kept, to perform a standard incremental analysis.

      Diff file list

      The diff file list is the file that contains the changed source files for Klocwork to analyze. All analyzed files must exist in the build specification generated by kwinject.

      Note: All files to be analyzed must exist in the build specification.

      Using Git

      If using Git, provide the previous commit that Git should perform a "diff" against. The change list between the current commit and the specified previous commit will be added to the diff file list for Klocwork to process by automatically calling "git diff <previous_commit>" during the build. Note: If you are using Git jenkins plugin to obtain source files for you pipeline job be sure to use 'Pipeline script from SCM' and specify the previous commit with the environment variable, 'GIT_PREVIOUS_COMMIT'. Also be aware that the first build in the job won't be able to access GIT_PREVIOUS_COMMIT and the first build will run full CI analysis.

      Manual

      If you are not using Git, or want to manually generate the change list by using Git, select this option. You will need to generate the diff file list by using a custom build-step (or similar). List one changed source file on each line of the file.

    • differentialAnalysisConfig
        Nested Object
      • diffType : String
      • gitPreviousCommit : String
      • diffFileList : String

step([$class: 'KlocworkFailureConditionPublisher']): Klocwork - Post Analysis (Full/CI) - Build Failure Conditions (Optional)

  • failureConditionConfig
      Nested Object
    • enableServerFailureCondition : boolean (optional)

      Full integration analysis build failure conditions (Full)

      Create multiple build failure conditions by using queries that are sent to the Klocwork Server through the Web API.

      Filter issues based on the search query, then provide the status to set the build to, along with the threshold (the number of issues to meet this criteria).

      Note: unless specified, the query runs with issue grouping turned off (grouping:off).

    • failureConditionServerConfigs (optional)
        Array / List of Nested Object
      • jobResult : String
      • query : String
      • threshold : String
      • conditionName : String
      • stopBuild : boolean
      • enableHTMLReporting : boolean
    • enableCiFailureCondition : boolean (optional)

      Differential analysis build failure conditions (CI)

      Set a threshold for the differential analysis build failure conditions. Pass the build if the threshold is not exceeded; fail otherwise.

      This step checks the XML report generated by the differential analysis build step. You can filter which issues appear in this report by providing additional options to the differential analysis build step.

      This step counts the total number of issues in the XML report.

    • enableDesktopFailureCondition : boolean (optional)
    • failureConditionCiConfig (optional)
        Nested Object
      • withDiffList : boolean
      • diffFileList : String
      • threshold : String (optional)
      • reportFile : String (optional)
      • enableHTMLReporting : boolean (optional)
      • enabledSeverites (optional)
          Nested Object
        • critical : boolean
        • error : boolean
        • warning : boolean
        • review : boolean
        • fiveToTen : boolean
      • enabledStatuses (optional)
          Nested Object
        • analyze : boolean
        • ignore : boolean
        • notAProblem : boolean
        • fix : boolean
        • fixInNextRelease : boolean
        • fixInLaterRelease : boolean
        • defer : boolean
        • filter : boolean
      • failUnstable : boolean (optional)
      • name : String (optional)
      • stopBuild : boolean (optional)
    • failureConditionCiConfigs (optional)
        Array / List of Nested Object
      • withDiffList : boolean
      • diffFileList : String
      • threshold : String (optional)
      • reportFile : String (optional)
      • enableHTMLReporting : boolean (optional)
      • enabledSeverites (optional)
          Nested Object
        • critical : boolean
        • error : boolean
        • warning : boolean
        • review : boolean
        • fiveToTen : boolean
      • enabledStatuses (optional)
          Nested Object
        • analyze : boolean
        • ignore : boolean
        • notAProblem : boolean
        • fix : boolean
        • fixInNextRelease : boolean
        • fixInLaterRelease : boolean
        • defer : boolean
        • filter : boolean
      • failUnstable : boolean (optional)
      • name : String (optional)
      • stopBuild : boolean (optional)
    • failureConditionDesktopConfig (optional)
        Nested Object
      • withDiffList : boolean
      • diffFileList : String
      • threshold : String (optional)
      • reportFile : String (optional)
      • enableHTMLReporting : boolean (optional)
      • enabledSeverites (optional)
          Nested Object
        • critical : boolean
        • error : boolean
        • warning : boolean
        • review : boolean
        • fiveToTen : boolean
      • enabledStatuses (optional)
          Nested Object
        • analyze : boolean
        • ignore : boolean
        • notAProblem : boolean
        • fix : boolean
        • fixInNextRelease : boolean
        • fixInLaterRelease : boolean
        • defer : boolean
        • filter : boolean
      • failUnstable : boolean (optional)
      • name : String (optional)
      • stopBuild : boolean (optional)

step([$class: 'KlocworkServerAnalysisBuilder']): Klocwork - Step 2 (Full) - Run Analysis

  • serverConfig
      Nested Object
    • buildSpec : String
      Build specification to use for analysis. Path is relative to the workspace.
    • tablesDir : String
      Specify the location of the tables directory, for example, ${MY_VAR}/kwtables.
    • incrementalAnalysis : boolean
    • ignoreCompileErrors : boolean
      Ignore compile errors encountered by kwbuildproject. This setting will not ignore a return code that indicates that kwbuildproject failed to the extent that no results are generated.
    • importConfig : String
      Optionally, provide configuration files to import to the project before running the analysis. If the checker configuration (for example, analysis_profile.pconf) is under version control, you can provide the file here and it will be automatically imported for each build.
      Specify multiple files by separating them with commas (",").
    • additionalOpts : String
    • disableKwdeploy : boolean
      By default, kwdeploy runs before the analysis, to ensure the checkers are up-to-date. Enable this setting if you don't want kwdeploy to run before the analysis.
    • duplicateFrom : String (optional)
      Optional setting to specify the name of an existing Klocwork project. Klocwork will duplicate that project's configuration settings.
    • enabledCreateProject : boolean (optional)
      Enable to create a new Klocwork project on the server if one does not exist with the name specified. This can be useful when using multi-branch pipeline jobs.

step([$class: 'KlocworkServerLoadBuilder']): Klocwork - Step 3 (Full) - Load Analysis Results

  • serverConfig (optional)
      Nested Object
    • tablesDir : String (optional)
    • buildName : String (optional)
      Specify the name of the build for the Klocwork server, for example, ${MY_VAR}-${GIT_COMMIT}. If empty, Klocwork uses an auto increment to name the builds.
    • additionalOpts : String (optional)
  • reportConfig (optional)
      Nested Object
    • displayChart : boolean
    • chartHeight : String (optional)
    • chartWidth : String (optional)
    • query : String (optional)

step([$class: 'KlocworkXSyncBuilder']): Klocwork - Post Analysis (Full) - Cross-Project Issue Sync (Optional)

  • syncConfig
      Nested Object
    • dryRun : boolean
      Cross synchronisation reads and writes to the Klocwork database. Therefore, we strongly recommend that you first try a Dry Run of the command (which skips the writing) and verify that the command works as expected.
    • lastSync : String
      Specify the "last synchronisation" date (how far back Klocwork should go when synchronising issue citations).
      Format is "DD-MM-YYYY hh:mm:ss".
      For example, "03-00-0000 00:00:00" will go back 3 days in time.
    • projectRegexp : String
      A regular expression that is used to retrieve Klocwork projects that should be processed during synchronisation. If you want to process all projects, leave empty.
      For example, if you prepend projects with "DEPT-" to indicate a particular department the regular expression "^DEPT-" will match all these projects
    • statusAnalyze : boolean
    • statusIgnore : boolean
    • statusNotAProblem : boolean
    • statusFix : boolean
    • statusFixInNextRelease : boolean
    • statusFixInLaterRelease : boolean
    • statusDefer : boolean
    • statusFilter : boolean
    • additionalOpts : String
      Additional options added to the kwxsync command.
      See the Klocwork documentation for more information.

klocworkWrapper: Klocwork - Build Environment Settings

  • serverConfig : String
    Create server configurations on the Configure System page.
  • installConfig : String
    You can create install configurations on the Configure System page. When used, the system updates the build environment's PATH variable to include the Klocwork installation PATH provided by the selected configuration.
  • serverProject : String
    The Klocwork Server project or stream to run a server build against or to connect to for CI analysis.
  • ltoken : String
    Optionally, specify a custom ltoken location. The Klocwork ltoken is used to authenticate with the Klocwork Server. The default ltoken location is in the .klocwork directory which is located in the home directory of the user running the process, for example: C:\Users\user_name\.klocwork\ltoken. See the Klocwork documentation for more information.

Was this page helpful?

Please submit your feedback about this page through this quick form.

Alternatively, if you don't wish to complete the quick form, you can simply indicate if you found this page helpful?

    


See existing feedback here.