fix(rp): adjust launch import endpoint after the latest RP update#926
fix(rp): adjust launch import endpoint after the latest RP update#926averevki merged 1 commit intoKuadrant:mainfrom
Conversation
Signed-off-by: averevki <sandyverevkin@gmail.com>
📝 WalkthroughWalkthroughThe JUnit import endpoint URL in the script is updated from Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
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 | 🟠 MajorAdd 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
📒 Files selected for processing (1)
scripts/junit2reportportal
zkraus
left a comment
There was a problem hiding this comment.
API endpoint is matching API listing in report portal. LGTM
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