Skip to content

USHIFT-7381: feat(microshift-ci): add --local mode to PCP dashboard generator#233

Open
suleymanakbas91 wants to merge 3 commits into
openshift-eng:mainfrom
suleymanakbas91:feat/pcp-dashboard-local-mode
Open

USHIFT-7381: feat(microshift-ci): add --local mode to PCP dashboard generator#233
suleymanakbas91 wants to merge 3 commits into
openshift-eng:mainfrom
suleymanakbas91:feat/pcp-dashboard-local-mode

Conversation

@suleymanakbas91

@suleymanakbas91 suleymanakbas91 commented Jul 16, 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
  • Add --build-id, --output, --title flags for CI integration (custom HTML <title> enables Spyglass toggle labeling)
  • Fix find/os.walk to follow symlinks, enabling local mode's symlink-based artifact layout

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 ... --title "Test PCP" --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, correct <title>Test PCP</title>
  • --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
    • Allow customizing the dashboard title shown in the browser and sidebar.
    • Generate dashboards either from a local scenario-info/ directory or from downloaded CI artifacts.
    • Support specifying build identifiers and custom output paths when generating the dashboard.
  • Bug Fixes
    • Improve scenario discovery through symbolic links, including cycle prevention and de-duplication.
    • Validate inputs to prevent conflicting options and ensure a usable data source is provided.
  • Chores
    • Bumped the microshift-ci plugin version to 1.5.0.

@openshift-ci

openshift-ci Bot commented Jul 16, 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 16, 2026
@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Walkthrough

The PCP dashboard tooling now supports local scenario-info/ input, customizable HTML titles and output paths, symlink-aware artifact discovery, URL-based downloading, and a plugin version bump to 1.5.0.

Changes

PCP dashboard tooling

Layer / File(s) Summary
Artifact input modes
plugins/microshift-ci/scripts/pcp-graphs/generate-dashboard.sh
The wrapper accepts either a local scenario-info/ directory or a Prow URL, validates the options, and prepares the corresponding artifact layout.
Symlink-aware discovery and output wiring
plugins/microshift-ci/scripts/pcp-graphs/extract_scenarios.py, plugins/microshift-ci/scripts/pcp-graphs/generate-dashboard.sh
Scenario, tarball, and hypervisor PCP searches follow symlinks, while dashboard generation forwards optional output and title arguments.
Configurable dashboard title
plugins/microshift-ci/scripts/pcp-graphs/create-pcp-dashboard.py
The generator accepts an escaped title through its API and CLI and applies it to the HTML document title and sidebar header.
Plugin version metadata
.claude-plugin/marketplace.json, plugins/microshift-ci/.claude-plugin/plugin.json
Both plugin version fields are updated from 1.4.2 to 1.5.0.

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

Possibly related PRs

Suggested labels: ready-for-human-review


Caution

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

  • Ignore

❌ Failed checks (1 error, 1 warning)

Check name Status Explanation Resolution
No-Sensitive-Data-In-Logs ❌ Error generate-dashboard.sh logs ${LOCAL_PATH} and ${BUILD_ID}/${SCENARIO}/${VM_HOST} to stderr, exposing paths and internal hostnames. Redact hostnames/paths in stderr output or gate them behind a debug flag; avoid printing VM_HOST and full artifact paths.
Ai-Attribution ⚠️ Warning PR/commits mention Claude Code, and the PR commits use Co-Authored-By: Claude Opus 4.6 instead of required Assisted-by/Generated-by trailers. Replace AI co-author trailers with Assisted-by: or Generated-by: in the affected commits/PR metadata, and remove Co-Authored-By for AI assistance.
✅ Passed checks (9 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 85.71% which is sufficient. The required threshold is 80.00%.
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 Touched files only adjust dashboard CLI/HTML and symlink traversal; no weak-crypto APIs or secret comparisons appear in the modified files.
Container-Privileges ✅ Passed The PR only changes dashboard scripts and version metadata; no container/K8s manifests add privileged, hostPID/Network/IPC, or allowPrivilegeEscalation settings.
No-Hardcoded-Secrets ✅ Passed Scanned all touched files and diff hunks; no API keys, tokens, passwords, private keys, credentialed URLs, or long base64 literals were present.
No-Injection-Vectors ✅ Passed No eval/sql/shell=True/yaml.load/pickle.loads found; user inputs are quoted or escaped, and innerHTML is only used to clear containers.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly reflects the main change: adding --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.

@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 16, 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: 3

🤖 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/extract_scenarios.py`:
- Line 26: Update the scenario discovery os.walk loop to prevent symlink cycles:
either stop following links or track visited (st_dev, st_ino) directory
identities and prune already-visited entries from dirs before traversal.
Preserve discovery of valid scenario directories while ensuring traversal cannot
recurse indefinitely.

In `@plugins/microshift-ci/scripts/pcp-graphs/generate-dashboard.sh`:
- Around line 6-10: Update the --local handling in generate-dashboard.sh so
LOCAL_PATH consistently denotes the parent directory containing scenario-info/:
link ${LOCAL_PATH}/scenario-info as the extractor’s scenario root and validate
that this directory exists before processing. Keep the documented CLI contract
and ensure traversal reaches the actual scenario directories rather than
treating scenario-info itself as a scenario.
- Around line 55-57: Validate the --build-id value in the argument-parsing
branch before assigning it to BUILD_ID, allowing only safe build-label
characters and rejecting traversal sequences such as ../ or path separators.
Preserve the existing missing-value error and usage behavior, and ensure only
the validated label reaches the mkdir and ln path construction.
🪄 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: fe032b82-2f16-4a8b-8009-d891e586e3b5

📥 Commits

Reviewing files that changed from the base of the PR and between 9d4247a and 5954808.

📒 Files selected for processing (3)
  • 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/extract_scenarios.py
Comment thread plugins/microshift-ci/scripts/pcp-graphs/generate-dashboard.sh Outdated
Comment thread plugins/microshift-ci/scripts/pcp-graphs/generate-dashboard.sh
suleymanakbas91 and others added 2 commits July 16, 2026 14:35
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>
@suleymanakbas91
suleymanakbas91 force-pushed the feat/pcp-dashboard-local-mode branch from d6bb537 to 50f6c08 Compare July 16, 2026 12:35
@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 16, 2026
- 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>
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. 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.

1 participant