Skip to content

USHIFT-7381: Add --local mode to PCP dashboard generator#238

Merged
openshift-merge-bot[bot] merged 7 commits into
openshift-eng:mainfrom
suleymanakbas91:feat/pcp-dashboard-local-mode
Jul 23, 2026
Merged

USHIFT-7381: Add --local mode to PCP dashboard generator#238
openshift-merge-bot[bot] merged 7 commits into
openshift-eng:mainfrom
suleymanakbas91:feat/pcp-dashboard-local-mode

Conversation

@suleymanakbas91

@suleymanakbas91 suleymanakbas91 commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add --local mode to generate-dashboard.sh so CI post steps can generate PCP dashboards from local artifact directories without downloading from GCS
  • Fix find/os.walk to follow symlinks, with cycle detection via inode tracking
  • Validate build label characters to prevent path traversal

Supersedes #233 (rebased, GitHub lost track of force-pushed commits).

Context

This is the edge-tooling side of adding a "Test PCP" toggle to MicroShift Prow job results. The companion PR in openshift/release will add a CI post step that:

  1. SCPs PCP archives from the hypervisor
  2. Runs generate-dashboard.sh --local ... --output custom-link-pcp.html
  3. The Spyglass HTML lens picks up the file and renders it as a collapsible toggle

Test plan

  • --local mode with real Prow job artifacts: 2 scenarios, 4/4 metrics each
  • --url mode unchanged (backward compatible)
  • End-to-end: trigger MicroShift e2e job with companion openshift/release PR

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added support for generating dashboards from either a Prow job URL or an existing local scenario directory.
    • Added an output option to control where the dashboard HTML is generated.
    • Dashboard title now displays in both the browser tab and the sidebar (“PCP Performance Dashboard”).
  • Bug Fixes

    • Improved scenario discovery to follow symlinks and avoid duplicate scenario traversal.
  • Chores

    • Updated the microshift-ci plugin version to 1.5.0.

suleymanakbas91 and others added 5 commits July 23, 2026 10:08
Enable generate-dashboard.sh to work with local scenario-info directories
(via --local flag) in addition to Prow URLs (--url). This allows CI post
steps to generate PCP dashboards directly from artifacts on the hypervisor
without downloading from GCS.

New flags: --local, --build-id, --output, --title.
Also adds --title support to create-pcp-dashboard.py for custom HTML titles,
and fixes symlink traversal in find/os.walk for local mode.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Prevent symlink cycles in extract_scenarios.py by tracking visited
  (st_dev, st_ino) pairs during os.walk with followlinks=True
- Validate --build-id against allow-list [a-zA-Z0-9._-] to reject
  path traversal sequences
- Fix --local help text to clarify it expects the scenario-info/
  directory path itself

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…modes

Address review: remove --build-id flag (hardcode "local" for local mode),
make --output and --title available in both --url and --local modes for
consistent interface.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@openshift-ci

openshift-ci Bot commented Jul 23, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: suleymanakbas91

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 23, 2026
@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Walkthrough

Changes

PCP dashboard generation

Layer / File(s) Summary
Dashboard inputs, discovery, and output
plugins/microshift-ci/scripts/generate-dashboard.sh
Adds mutually exclusive URL and local input modes, validates arguments, prepares the workdir, follows symlinked artifacts, and supports an optional output path.
Symlink-aware scenario traversal
plugins/microshift-ci/scripts/extract_scenarios.py
Follows directory symlinks while preventing repeated traversal through device and inode tracking.
Dashboard label and plugin release metadata
plugins/microshift-ci/scripts/pcp-graphs/create-pcp-dashboard.py, .claude-plugin/marketplace.json, plugins/microshift-ci/.claude-plugin/plugin.json
Renames the generated sidebar heading to “PCP Performance Dashboard” and updates both plugin manifests to version 1.5.0.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Suggested labels: ready-for-human-review

🚥 Pre-merge checks | ✅ 9 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Ai-Attribution ⚠️ Warning AI use is explicit, but the PR commits use Co-Authored-By: Claude Opus 4.6 and lack Assisted-by/Generated-by trailers. Replace AI coauthor lines with Red Hat-approved Assisted-by or Generated-by trailers on the affected commits/PR text.
✅ Passed checks (9 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
No-Weak-Crypto ✅ Passed No MD5/SHA1/DES/RC4/3DES/Blowfish/ECB, custom crypto, or secret/token comparisons appear in the changed files.
Container-Privileges ✅ Passed No privileged, hostPID/Network/IPC, SYS_ADMIN, or allowPrivilegeEscalation settings were found; the changed files are plugin metadata and scripts, not K8s manifests.
No-Sensitive-Data-In-Logs ✅ Passed The diff only hardcodes the dashboard title/removes --title; it adds no new logging that exposes secrets or PII, and existing stderr messages are unchanged.
No-Hardcoded-Secrets ✅ Passed Changed files only adjust dashboard title/args; scans found no secret-like literals, base64 blobs, private keys, or embedded credentials.
No-Injection-Vectors ✅ Passed Modified scripts contain no eval/exec/pickle/yaml/os.system/subprocess shell=True or dangerous HTML sinks; dashboard uses textContent/html.escape.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: adding a --local mode to the PCP dashboard generator.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@coderabbitai coderabbitai Bot added the ready-for-human-review Indicates a PR has been reviewed by automated tools and is ready for human review label Jul 23, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@plugins/microshift-ci/scripts/pcp-graphs/create-pcp-dashboard.py`:
- Around line 318-319: Wrap the overlong statements in build_html and the
additional lines around 392–393 so each Python line stays within the
79-character PEP 8 limit, preserving the existing function signature and
behavior.

In `@plugins/microshift-ci/scripts/pcp-graphs/extract_scenarios.py`:
- Around line 22-33: Move the `seen` set initialization inside the `for build_id
in os.listdir(artifacts_root)` loop so inode de-duplication is reset for each
logical build while preserving cycle protection within that build’s `os.walk`
traversal. Add regression coverage for multiple symlinked build IDs pointing to
the same directory and for cyclic links, verifying scenarios are retained per
build and traversal terminates.

In `@plugins/microshift-ci/scripts/pcp-graphs/generate-dashboard.sh`:
- Around line 88-91: Update process_hypervisor_dir to retain and process the
local build directory when numeric ID extraction fails, using the existing
BUILD_ID value (including “local”) as the fallback; preserve numeric extraction
behavior for other builds.
- Line 87: Update the --local argument parsing in generate-dashboard.sh to
reject paths containing parent-traversal components before LOCAL_PATH is
canonicalized with cd and pwd. Preserve valid relative and absolute paths, and
add tests covering both accepted paths and rejected ../ traversal inputs.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: 2cc28a06-126f-4ce4-8d26-402f48d0e859

📥 Commits

Reviewing files that changed from the base of the PR and between 6b92924 and 6327e26.

📒 Files selected for processing (5)
  • .claude-plugin/marketplace.json
  • plugins/microshift-ci/.claude-plugin/plugin.json
  • plugins/microshift-ci/scripts/pcp-graphs/create-pcp-dashboard.py
  • plugins/microshift-ci/scripts/pcp-graphs/extract_scenarios.py
  • plugins/microshift-ci/scripts/pcp-graphs/generate-dashboard.sh

Comment thread plugins/microshift-ci/scripts/pcp-graphs/create-pcp-dashboard.py Outdated
Comment thread plugins/microshift-ci/scripts/pcp-graphs/extract_scenarios.py Outdated
Comment thread plugins/microshift-ci/scripts/pcp-graphs/generate-dashboard.sh
Comment thread plugins/microshift-ci/scripts/pcp-graphs/generate-dashboard.sh
@suleymanakbas91
suleymanakbas91 force-pushed the feat/pcp-dashboard-local-mode branch from 6ef682b to 1405625 Compare July 23, 2026 08:32
@suleymanakbas91 suleymanakbas91 changed the title feat(microshift-ci): add --local mode to PCP dashboard generator USHIFT-7381: feat(microshift-ci): add --local mode to PCP dashboard generator Jul 23, 2026
@suleymanakbas91 suleymanakbas91 changed the title USHIFT-7381: feat(microshift-ci): add --local mode to PCP dashboard generator USHIFT-7381: Add --local mode to PCP dashboard generator Jul 23, 2026
suleymanakbas91 and others added 2 commits July 23, 2026 10:47
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The title is not parameterized — hardcode "PCP Performance Dashboard"
in the HTML template directly.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@ggiguash

Copy link
Copy Markdown
Contributor

/lgtm

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Jul 23, 2026
@openshift-merge-bot
openshift-merge-bot Bot merged commit b529abe into openshift-eng:main Jul 23, 2026
5 checks passed
@suleymanakbas91
suleymanakbas91 deleted the feat/pcp-dashboard-local-mode branch July 23, 2026 13:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. ready-for-human-review Indicates a PR has been reviewed by automated tools and is ready for human review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants