USHIFT-7381: feat(microshift-ci): add --local mode to PCP dashboard generator#233
USHIFT-7381: feat(microshift-ci): add --local mode to PCP dashboard generator#233suleymanakbas91 wants to merge 3 commits into
Conversation
|
[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 DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
WalkthroughThe PCP dashboard tooling now supports local ChangesPCP dashboard tooling
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Suggested labels: Caution Pre-merge checks failedPlease resolve all errors before merging. Addressing warnings is optional.
❌ Failed checks (1 error, 1 warning)
✅ Passed checks (9 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
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
📒 Files selected for processing (3)
plugins/microshift-ci/scripts/pcp-graphs/create-pcp-dashboard.pyplugins/microshift-ci/scripts/pcp-graphs/extract_scenarios.pyplugins/microshift-ci/scripts/pcp-graphs/generate-dashboard.sh
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>
d6bb537 to
50f6c08
Compare
- 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>
Summary
--localmode togenerate-dashboard.shso CI post steps can generate PCP dashboards from local artifact directories without downloading from GCS--build-id,--output,--titleflags for CI integration (custom HTML<title>enables Spyglass toggle labeling)find/os.walkto follow symlinks, enabling local mode's symlink-based artifact layoutContext
This is the edge-tooling side of adding a "Test PCP" toggle to MicroShift Prow job results. The companion PR in
openshift/releasewill add a CI post step that:generate-dashboard.sh --local ... --title "Test PCP" --output custom-link-pcp.htmlTest plan
--localmode with real Prow job artifacts: 2 scenarios, 4/4 metrics each, correct<title>Test PCP</title>--urlmode unchanged (backward compatible)🤖 Generated with Claude Code
Summary by CodeRabbit
scenario-info/directory or from downloaded CI artifacts.