OTA-2024: Add plc_lookup.py CLI and update product-lifecycle skill - #35
Conversation
Replace inline curl/jq commands with a standalone Python CLI wrapping the Product Life Cycle API. Addresses all review feedback from PR openshift#13: - Pass through raw API status types instead of normalizing to custom strings (avoids conflating unknown statuses) - Include all lifecycle phases in output, not just 3 hardcoded ones (API has 18 distinct phase types) - Use defaultdict(list) for package-to-product lookup to preserve all products when multiple share a package (e.g. skupper-operator) - Include former_names in output for search verification - Drop pagination (--limit/--offset) as it has unclear value with no stable ordering guarantee from the API - Support direct import via main(args=[], output=) for testability - Set executable bit, rely on shebang SKILL.md rewritten to reference the CLI tool without exposing API version or internal tool details. Deleted orphaned api-details.md. 22 unit tests (mocked) + 7 integration tests (live API, opt-in). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
@jhadvig: This pull request references OTA-2024 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the task to target either version "5.0." or "openshift-5.0.", but it targets "openshift-5.1" instead. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Skip API calls for empty/missing package names in olm-check, report them as lifecycle_unavailable immediately - Add tests for api_search error handling: URLError (API down), invalid JSON response, and missing "data" key in response - Add test verifying empty packages don't trigger API calls Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Test results26 unit tests + 7 live API tests pass. CLI produces correct structured JSON output. |
|
@wking PTAL 🙏 |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: jhadvig, matzew 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 |
|
/override eval (The eval failure is pre-existing) |
|
/override "ci/prow/eval" |
|
/override ci/prow/eval |
|
@matzew: /override requires failed status contexts, check run or a prowjob name to operate on.
Only the following failed contexts/checkruns were expected:
If you are trying to override a checkrun that has a space in it, you must put a double quote on the context. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
@matzew: Overrode contexts on behalf of matzew: ci/prow/eval DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
@matzew: Overrode contexts on behalf of matzew: ci/prow/eval DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
/verified by @jhadvig |
|
@jhadvig: This PR has been marked as verified by DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
@jhadvig: all tests passed! Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
Summary
plc_lookup.py) wrapping the Product Life Cycle APIreferences/api-details.mdTrevor's feedback addressed
STATUS_MAPwith"unknown"fallback conflating distinct statusesphasesarray (API has 18 distinct types)by_package[pkg] = psilently drops duplicatesdefaultdict(list)preserves all products per packageapi_search(pkg)fails for packages like skupper-operator--limit/--offsetwith no ordering guaranteepython3 plc_lookup.pychmod +x, invoked as./plc_lookup.pyallowed-toolsfrontmatterassertGreater, no debug hintsassertEqualeverywhere, debug messagesmain(args=[], output=)What's NOT changed
update-advisor/SKILL.mdis untouched (Trevor's PR NO-ISSUE: cluster-update/update-advisor: Refactor to avoid numbered sections and tweak order #21 structure is the agreed state)allowed-toolsin frontmatterCI
A companion PR adds a
unitpresubmit CI job to run these tests on every PR: openshift/release#81732. It reuses the existingskill-scannerimage (Python 3.11) and runspython3 -m unittest discoveragainstcluster-update/product-lifecycle/scripts/tests/. Skips on docs-only and evals-only changes.Test plan
python3 -m unittest cluster-update/product-lifecycle/scripts/tests/test_plc_lookup.py -v(33 pass)PLC_LIVE_TESTS=1 python3 -m unittest ... -k Live(7 pass)./cluster-update/product-lifecycle/scripts/plc_lookup.py products "logging for Red Hat OpenShift" --ocp 4.21allowed-tools, nov2references/cc @wking