There are situations where you might want to manually import pre-generated analysis results into your on-prem instance of CodeScene. Here’s a step-by-step guide to safely perform that process.
Step 1: Create a New Project with a Dummy Repository
Start by creating a new project in CodeScene.
To initialize it, scan a small local Git repository stored on your hard drive - ideally, a minimal open-source repo. The purpose of this dummy repo is simply to generate the required directory structure for the project.
Once the project is created, run the analysis to produce the initial analysisXXX
folder.
Step 2: Locate the Analysis Directory
Open Docker Desktop and navigate to the following path inside the container:
files -> codescene -> analysis -> [project-name] -> analysisXXX
You’ll see a folder named something like analysis000001
, alongside a lock file named create-analysis-dir.lck
.
Note:
Ensure that the CodeScene version used to generate the analysis (e.g.,codescene/codescene:latest
) matches between your environment and theone you're importing the analysis results from. Version mismatches may cause compatibility issues when loading imported results.
Step 3: Replace the Dummy Analysis Folder
Now it’s time to replace the generated analysis with the one you want to import:
-
Rename the folder containing the analysis results you want to import so that it exactly matches the name of the existing
analysisXXX
folder (e.g.,analysis000001
). -
Delete the original
analysisXXX
folder. -
Move the renamed analysis folder into the same location.
Important:
Do not delete or modify the
create-analysis-dir.lck
file. CodeScene uses it to track analysis creation. If altered, the system may ignore or overwrite the imported data.Double-check that folder names match exactly. A mismatch can cause the analysis not to show up or even break the project setup.
Step 4: View the Imported Results
Return to the CodeScene dashboard.
You’ll now see the imported project scan listed and available for exploration, just like any regular analysis run.
Final Tips
-
Use this approach only when necessary (e.g., reviewing external analysis).
-
Always take backups before making changes to the analysis directory structure.
For any unexpected behavior or errors during this process, reviewing the application logs can help diagnose folder name mismatches or permission issues.