Skip to content

fix(rp): adjust launch import endpoint after the latest RP update#926

Merged
averevki merged 1 commit intoKuadrant:mainfrom
averevki:fix-junit-import-endpoint
Apr 8, 2026
Merged

fix(rp): adjust launch import endpoint after the latest RP update#926
averevki merged 1 commit intoKuadrant:mainfrom
averevki:fix-junit-import-endpoint

Conversation

@averevki
Copy link
Copy Markdown
Contributor

@averevki averevki commented Apr 8, 2026

There is a new API endpoint for importing junit files now https://reportportal.io/docs/log-data-in-reportportal/ImportDataToReportPortal/#import-via-api

Summary by CodeRabbit

  • Bug Fixes
    • Updated JUnit import integration with ReportPortal to use the correct API endpoint.

Signed-off-by: averevki <sandyverevkin@gmail.com>
@averevki averevki requested review from silvi-t and zkraus April 8, 2026 12:33
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 8, 2026

📝 Walkthrough

Walkthrough

The JUnit import endpoint URL in the script is updated from .../api/v1/{project}/launch/import to .../api/v1/plugin/{project}/junit/import, and a missing newline is added to the file end. No functional logic or request structure changes.

Changes

Cohort / File(s) Summary
Endpoint Update
scripts/junit2reportportal
ReportPortal API endpoint URL changed to route through plugin-specific JUnit import endpoint; file newline formatting corrected.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 A hop, a skip, through endpoints we go,
From launch to junit, the new pathway's aglow,
With newlines so tidy at the end of our script,
The rabbit's quick fix gives the imports a lift!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description lacks the required structure from the template, missing the Changes and Verification sections that outline what was modified and how it was tested. Expand the description to include structured sections: a brief overview, a list of main changes (endpoint URL modification), and verification details (how the change was tested).
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adjusting the launch import endpoint to a new ReportPortal API endpoint as documented.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
scripts/junit2reportportal (1)

116-125: ⚠️ Potential issue | 🟠 Major

Add timeout and explicit HTTP failure handling to the upload call.

The current requests.post(...) can block indefinitely without a timeout. Additionally, the script prints the response text without checking the status code, so HTTP errors silently fail rather than aborting. This is problematic in CI/CD environments where indefinite hangs stall pipelines and silent failures go undetected.

Add a timeout parameter and fail fast on non-2xx responses using raise_for_status():

Proposed hardening patch
-print(
-    requests.post(
-        launch_import,
-        files={
-            "file": (f"{args.launch_name}.zip", stream.getbuffer(), "application/zip"),
-            "launchImportRq": (None, json.dumps(launch_import_rq), "application/json"),
-        },
-        headers=auth,
-    ).text
-)
+try:
+    response = requests.post(
+        launch_import,
+        files={
+            "file": (f"{args.launch_name}.zip", stream.getbuffer(), "application/zip"),
+            "launchImportRq": (None, json.dumps(launch_import_rq), "application/json"),
+        },
+        headers=auth,
+        timeout=60,
+    )
+    response.raise_for_status()
+    print(response.text)
+except requests.RequestException as exc:
+    sys.exit(f"Failed to import JUnit results into ReportPortal: {exc}")
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@scripts/junit2reportportal` around lines 116 - 125, The requests.post call
that uploads the zip (the call constructing files with "file" and
"launchImportRq") must include a timeout and explicit HTTP failure handling;
change the inline call to assign the response to a variable (e.g., resp =
requests.post(..., timeout=<seconds>, headers=auth)), then call
resp.raise_for_status() to raise on non-2xx and finally print or log resp.text;
ensure the timeout value is reasonable for CI (e.g., 60s) and keep the same
files and headers arguments when making the change.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@scripts/junit2reportportal`:
- Around line 116-125: The requests.post call that uploads the zip (the call
constructing files with "file" and "launchImportRq") must include a timeout and
explicit HTTP failure handling; change the inline call to assign the response to
a variable (e.g., resp = requests.post(..., timeout=<seconds>, headers=auth)),
then call resp.raise_for_status() to raise on non-2xx and finally print or log
resp.text; ensure the timeout value is reasonable for CI (e.g., 60s) and keep
the same files and headers arguments when making the change.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 75a3810c-a7aa-40c6-a348-2ba103389005

📥 Commits

Reviewing files that changed from the base of the PR and between d6450a3 and 6e0aed7.

📒 Files selected for processing (1)
  • scripts/junit2reportportal

Copy link
Copy Markdown
Contributor

@zkraus zkraus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

API endpoint is matching API listing in report portal. LGTM

Copy link
Copy Markdown
Contributor

@silvi-t silvi-t left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@averevki averevki merged commit 63979b0 into Kuadrant:main Apr 8, 2026
5 checks passed
@averevki averevki deleted the fix-junit-import-endpoint branch April 8, 2026 13:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants