Check for user in iib_no_ocp_label_allow_list#1304
Conversation
Reviewer's GuideExtends the build_merge_index_image logic so that missing bundle OCP version labels can also be allowed based on the requesting user, and adds tests to cover both allowed and disallowed user scenarios when ignore_bundle_ocp_version is enabled. Sequence diagram for allow_no_ocp_version evaluation in build_merge_index_imagesequenceDiagram
actor Requestor
participant IIBWorker
participant BuildMergeTask as _add_bundles_missing_in_source
participant RequestStore as get_request
participant Config as get_worker_config
Requestor->>IIBWorker: submit merge index image request
IIBWorker->>BuildMergeTask: _add_bundles_missing_in_source(request_id, ignore_bundle_ocp_version)
alt ignore_bundle_ocp_version is True
BuildMergeTask->>RequestStore: get_request(request_id)
RequestStore-->>BuildMergeTask: request_data (includes user)
BuildMergeTask->>Config: get_worker_config()
Config-->>BuildMergeTask: config (includes iib_no_ocp_label_allow_list)
loop for each entry in iib_no_ocp_label_allow_list
BuildMergeTask->>BuildMergeTask: check target_index_tmp startswith entry
BuildMergeTask->>BuildMergeTask: check source_from_index startswith entry
BuildMergeTask->>BuildMergeTask: check user equals entry
end
BuildMergeTask->>BuildMergeTask: set allow_no_ocp_version based on any match
else ignore_bundle_ocp_version is False
BuildMergeTask->>BuildMergeTask: set allow_no_ocp_version to False
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Review Summary by QodoAdd user check to iib_no_ocp_label_allow_list validation
WalkthroughsDescription• Add user validation to iib_no_ocp_label_allow_list check • Allow users in allow list to bypass OCP label validation • Import get_request function for retrieving user information • Add comprehensive test coverage for user allow list scenarios Diagramflowchart LR
A["ignore_bundle_ocp_version flag"] --> B["Get request user info"]
B --> C["Check allow list"]
C --> D["Match by index OR user"]
D --> E["Allow or reject bundle"]
File Changes1. iib/workers/tasks/build_merge_index_image.py
|
Code Review by Qodo
1. Test triggers real HTTP
|
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- Mixing index prefixes and usernames in the same
iib_no_ocp_label_allow_listentry type makes the semantics of the allow list unclear; consider splitting this into separate config keys (e.g. index prefixes vs allowed users) or clearly distinguishing types in code. - Accessing
get_request(request_id)['user']assumes theuserkey is always present; consider using.get('user')with a safe default or handling the missing-key case explicitly to avoid aKeyError.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Mixing index prefixes and usernames in the same `iib_no_ocp_label_allow_list` entry type makes the semantics of the allow list unclear; consider splitting this into separate config keys (e.g. index prefixes vs allowed users) or clearly distinguishing types in code.
- Accessing `get_request(request_id)['user']` assumes the `user` key is always present; consider using `.get('user')` with a safe default or handling the missing-key case explicitly to avoid a `KeyError`.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
3a5eaa5 to
f5639d6
Compare
chandwanitulsi
left a comment
There was a problem hiding this comment.
Overall looks good, one question on unrelated change
|
I agree with the comments from Yash and Tulsi. Let's address it and then we can do final approval. |
|
Important Please propagate this change to main branch as well. |
f5639d6 to
61407fa
Compare
Signed-off-by: Michal Zelenák <mychalze@gmail.com>
1c174eb to
e38a29a
Compare
package pkg_resources is not available anymore, and the pipeline is failing Signed-off-by: Michal Zelenák <mychalze@gmail.com>
e38a29a to
44f0659
Compare
d30454c
into
release-engineering:master
Summary by Sourcery
Allow bundle addition when the requesting user is configured to bypass missing OCP version labels.
Enhancements:
Tests: