-
Notifications
You must be signed in to change notification settings - Fork 518
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: gerrit python plugin #6786
Conversation
Looping @klesh @Startrekzky may also interested |
Does this support all gerrit versions? |
request.headers["Authorization"] = f"Basic {basic_auth}" | ||
|
||
@response_hook | ||
def remove_extra_content_in_json(self, response: Response): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To prevent against Cross Site Script Inclusion (XSSI) attacks, the JSON response body starts with a magic prefix line that must be stripped before feeding the rest of the response body to a JSON parser:
Ref: https://gerrit-documentation.storage.googleapis.com/beta/rest-api.html#output-format
If the admin configure site.allowOriginRegex
correctly, then the output should be OK for json parse directly, and this
remove_extra_content_in_json
could always process the output w/o any pre configure on site.allowOriginRegex
.
Not sure, we're using v3.4.3 and I've done some UT in code with the https://gerrit.onap.org/r (V3.7.2) |
Excellent stuff @matrixji . Since not many contributors know Python, it might take some take to review and merge the PR. |
The PR is currently marked as |
|
], | ||
}, | ||
dataScope: { | ||
localSearch: true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this plugin have no API to support searching data scope?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Gerrit API should support searching, but sems python plugin framework not exporting this(not very sure) ...
ref:
return &plugin.ApiResourceOutput{Status: http.StatusNotImplemented}, nil |
plugin: 'gerrit', | ||
name: 'Gerrit', | ||
icon: ({ color }) => <Icon fill={color} />, | ||
sort: 7, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please double-check its sort.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've no idea which sort
should be used, my understanding is: that this sort
is just used for icon layout in UI.
d952464
to
07b8387
Compare
Signed-off-by: Ji Bin <matrixji@live.com>
Signed-off-by: Ji Bin <matrixji@live.com>
Summary
Provide a Python/plugin for support collecting data from Gerrit.
Does this close any open issues?
Closes #5871
Screenshots
Other Information
This is a WIP PR, currently, I use this code for collecting Gerrit changes/commits from the Gerrit server. If possible, I hope this could be merged into the master, I'm not sure if Python's plugin could provide full ability as the Golang's plugin does, Any comments are welcome.