cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Custom Reports in Code Insight: Additional Procedure Required When Migrating to 2023 R4 or Later

Custom Reports in Code Insight: Additional Procedure Required When Migrating to 2023 R4 or Later

Introduction

Code Insight 2023 R4 upgraded from Tomcat version 8.5.x to version 9.0.80 to address the Code Insight Jira issue SCA-48120: Upgrade Tomcat from 8.x to 9.x or above. The upgrade was necessary because Apache had announced that support for Tomcat 8.5.x  would end by March 31, 2024. (To read the complete announcement, refer to Apache Tomcat® - End of life for Apache Tomcat 8.5.x.) However, the pre-release testing of 2023 R4 revealed that, after the Tomcat upgrade, the generation of custom reports was failing, as reported in the Code Insight Jira issue SCA-50793: Reports - Generation of custom reports is failing.

This issue was resolved before the actual release of Code Insight 2023 R4. However, the issue's solution requires that customers migrating from a pre-2023 R4 release of Code Insight to 2023 R4 or later perform an extra procedure to ensure that their custom reports successfully generate.

The following sections provide more information about the issue, its solution, and the additional procedure needed to migrate custom reports.   

Issue with Custom Reports After the Tomcat Upgrade 

Custom reports are scripted in the Python language. After the Tomcat upgrade, the generation of custom reports was failing because the Content-Type normally passed to the uploadReports API (called in the custom report scripts) was no longer compatible with the upgrade. 

Furthermore, research indicated that the Content-Type should not be passed explicitly in the header for a multi-part form, as stated in the following quote from the maintainer of the Requests Library in Python: “You should NEVER set that header yourself. We set the header properly with the boundary. If you set that header, we won't and your server won't know what boundary to expect (since it is added to the header).” (Refer to multipart data POST using python requests: no multipart boundary was found - Stack Overflow.)

Solution

Based on this information, the solution for this issue was simply to remove the Content-Type from the header in each custom-report script so that its value was no longer passed to the uploadReports API in the script.

Impact of the Solution on Code Insight Versions 

As a result of the solution, users who have migrated from a pre-2023 R4 version of Code Insight to 2023 R4 or later must perform an additional procedure to update their  previously downloaded custom-report scripts to the latest version. (See the next section, Required Procedure for Updating Custom Report Scripts, for details.) If this procedure is not performed, attempts to generate custom reports will fail. 

You do not have to perform this additional procedure under these circumstances:

  • If you are using Code Insight 2023 R3 or earlier. (Even if you perform the additional procedure, the custom reports will still generate successfully.)
  • If you are using Code Insight 2023 R4 or later and are installing the custom-report scripts for the first time
  • If you are migrating from a pre-2023 R4 version of Code Insight to 2023 R4  but did not copy the custom-report scripts from the previous release.  

Procedure to Update Custom-Report Scripts Based on the Solution

Perform the following procedure to update your existing custom-report scripts after you have migrated from a pre-2023 R4 version of Code Insight to version 2023 R4 or later. If you do not perform this procedure, attempts to generate custom reports will fail.

Purpose of the Procedure

The procedure, which is performed from the Linux or Windows instance in which Code Insight is installed, pulls the latest code from Git that incorporates the solution described above.

Updating the Custom-Report Scripts

Use the following procedure to update the custom-report scripts migrated from a pre-2023 R4 version.

To update custom-report scripts: 

  1. In a command-line window, navigate to the following location where your custom-report scripts are installed in Code Insight:
    <codeInsight_installation_folder>/custom_report_scripts
  2. Within a report folder, run the following command to pull the latest code from Git:
    git pull --recurse-submodules

    Alternatively, run these two commands:
    git pull
    git submodule update --recursive
  3. Repeat the previous step for each report folder.

After you perform this procedure, custom reports will generate successfully. 

NOTE: You do not need to restart Tomcat to enable the updated scripts.

More Information

For more information about custom reports in Code Insight, refer to the Code Insight Reports and  Custom Reports Framework in Code Insight articles or to the Generating Reports for a Project section in the Code Insight User Guide.  

Labels (1)
Was this article helpful? Yes No
No ratings
Version history
Last update:
‎Nov 09, 2023 10:07 AM
Updated by:
Contributors