-
Notifications
You must be signed in to change notification settings - Fork 7
Let qiita_client handle file fetching and pushing to/from Qiita central, instead of plugins #60
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
base: master
Are you sure you want to change the base?
Conversation
…environment variable - as config files are not parsed in most test cases
…lity with old py27 for tests)
allow for file/dir deletion in test mode
also return full filepath when in filesystem mode
test if fileobject exists prior to delete attempt
after calling a plugin function, push files of artifacts to qiita cen…
add an interception to automatically fetch files from qiita central
|
Wow, really cool; thank you for your efforts on this. I'll review the other PRs and come back to this one after they are merged. My only comments at this point are:
|
| try: | ||
| from json import JSONDecodeError | ||
| except ImportError: | ||
| # dirty hack to cope with the fact that python 2.7 does not have |
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.
What’s using 2.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.
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.
Ugh.
Hi @antgonza
Overview
This is a follow up PR to #57. When I worked on integrating the new functionality into multiple existing plugins, I came across several issues. After testing some alternative ideas, I came to the conclusion that it might be best, if I outsource the actual file transfer (only if using protocol "https") into
qiita_clientinstead of touching each plugin's code.Therefore, I identified three central locations, one for fetching files from central to plugin and two to push newly computed results to central:
A plugin consists of one or multiple QiitaCommands which get eventually called remotely from Qiita. Instead of "just" returning it's result in the
__call__function, I now traverse the results and push all registered files from the plugin to Qiita central. By default, i.e. using existing "filesystem" protocol, nothing will be moved, aspush_file_to_centralsimply returns the provided filepath: https://github.com/jlab/qiita_client/blob/16671cabee644a1ddc2ebca7785e9a0fed785525/qiita_client/qiita_client.py#L839-L840patchcall can update filepaths that point to html and support files in the database. To actually make these files available, they need to get pushed from plugin to central additionally. I am doing this, by testing which API endpoint is called via the general methodpatchand push files to Qiita central ifpath == ' /html_summary': https://github.com/jlab/qiita_client/blob/2321dbe973df0f17f4151c69ce73fa83afa017b6/qiita_client/qiita_client.py#L584-L602getcalls on two different API endpoints here: https://github.com/jlab/qiita_client/blob/2321dbe973df0f17f4151c69ce73fa83afa017b6/qiita_client/qiita_client.py#L485-L504, where I now inject testing for plugincoupling protocol and the two API endpoints and eventually fetch requested artifact files from central prior to triggering the pluginQiitaCommands.I furthermore realized that e.g.
qtp-job-output-folderoperates not on individual filepaths, managed by the postgred DB, but on while black box directories. Therefore, I needed to extend the fetch/push mechanism accordingly, which requires to zip/unzip folder-content to be transported as one "file" throughGETandPOSTrequests. In addition,qtp-job-output-folderalso needs to clean up test files that have been pushed to Qiita central; thus I had to add adelete_file_from_centralfunction: https://github.com/jlab/qiita_client/blob/2321dbe973df0f17f4151c69ce73fa83afa017b6/qiita_client/qiita_client.py#L988 but still am worried about abuse and thus only make it available if Qiita central is in testmode. These additions also require changes in theqiita_pet/handlers/cloud_handlersendpoints of qiita central. The according PR is qiita-spots/qiita#3483Minor solved issues
PluginTestCaseclass of the qiita_client to also check the environment variableQIITA_PLUGINCOUPLING. Thus, by setting this env, tests will enable different protocols even though they don't adhere to the value in the generated plugin configuration file.makedirsfunction compatible. The argumentexist_okdid not exist in py2.Result
I am here testing the integration of qiita, nginx, and 8 plugins coupled through the new https protocol:

To see if changes negatively affect the traditional
filesystemcoupling, i.e. operate as is, I test this as well:Roadmap
Once PRs for qiita and qiita_client are merged, I will create according PRs for the 8 plugins I am using so far. They have currently modified github actions to use my development branches; thus they need to be adopted first. An overview is here: jlab/qiita-keycloak#49 You might notice in the PRs of the plugins, that no change of the productive plugin code is necessary. However, tests need to be modified, as they often locally create some tests files, assuming direct access to
BASE_DATA_DIR, which is not the case in my uncoupled tests. Annoyingly, theconfiguration_***script has to be extended by the newplugincouplingargument.Note: to pass tests, I changed the branch of Qiita, used in the github action. Revert to
devprior merge! https://github.com/jlab/qiita_client/blob/2321dbe973df0f17f4151c69ce73fa83afa017b6/.github/workflows/qiita-ci.yml#L55-L59