Skip to content
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

Connect new API to the old dashboard #147

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

alexandrasp
Copy link

As we work on the new API for Kernel CI, we experiment with using it in the current dashboard. The goals are twofold: test the state of the API to build a Web Dashboard and provide visualization of test runs with the new API in the current legacy dashboard; meanwhile, we don't have a new one.

Below you will see a description of the work and screens.

In the first page: page_1

You can see all job reports sent to the API, and using the pre-existent template, we bring data from the new API and show information about a job, restringing to tree, branch, kernel version, date and status.

Once you select a row, combining kernel version, tree and branch, we will show, on the second page, which test plans we have for that given combined information:
page_2

Finally, in the third view, you can see all details of a given test plan combined with kernel version, date and branch.
Example page 3: page_3
Example page 3.1: page_3 1
Example page 3.2: page_3 2

We already have some discussion around a new dashboard in progress (see some user stories being discussed ) the idea here is not to bring these views as the solution for this problem but a way to interact and gather information from the new API and experiment with it in a reasonable way to visualize data from new integrations as well (fstests, kunit).

  • New Kernel CI API is a work in progress, but we have been missing kernel revision information for over a week. I don't know if it is expected or even if it will be something permanent.

  • Another thing, the API is not yet saving the logs in the DB. As we know, having the log information about the build is helpful in case of any problem or regression.

  • It was tested locally, as shown in the screenshot above, using an API key and setting the BACKEND_URL in the config file to the new API on staging.

Alexandra Pereira added 2 commits December 12, 2022 11:52
Include a new view to show information about jobs coming
from new Kernel CI API.

- add new route.py to Kernel CI API.
- add a new ajax route to /nodes.
- add DONE as status option.
- update common.js and html.js to handle date as
JS object.
- add new-api-jobs-all with all logic behind getting
data and show on html file.

Signed-off-by: Alexandra Pereira <alexandra.pereira@collabora.com>
add a new page to interact with the new Kernel CI API
and show test plans for a given combination of
job, branch and kernel.

- add view-new-api-job-branch-kernel.2022.11.js with all logic
behing getting data from Kernel CI API and showing on html file.
- add links from the base URL to this new view.
- add new html file to with scrips to the new route
new-api-job-branch-kernel.
- add the URL rule with job, branch and kernel information.

Signed-off-by: Alexandra Pereira <alexandra.pereira@collabora.com>
@alexandrasp alexandrasp requested a review from a team December 13, 2022 17:16
@alexandrasp alexandrasp self-assigned this Dec 13, 2022
@nuclearcat
Copy link
Member

It looks like it is failing on staging (not sure yet):

fatal: [staging.kernelci.org]: FAILED! => {"changed": true, "cmd": ["nodejs", "/srv/staging.kernelci.org/app/dashboard/static/js/lib/r.js", "-o", "/srv/staging.kernelci.org/app/dashboard/static/js/build.js"], "delta": "0:00:00.323137", "end": "2022-12-16 07:03:10.389187", "msg": "non-zero return code", "rc": 1, "start": "2022-12-16 07:03:10.066050", "stderr": "", "stderr_lines": [], "stdout": "Error: Error: ERROR: module path does not exist: kci-new-api-job-branch-kernel-plan.js for module named: kci-new-api-job-branch-kernel-plan.js. Path is relative to: /home/kernelci\n    at /srv/staging.kernelci.org/app/dashboard/static/js/lib/r.js:26773:35", "stdout_lines": ["Error: Error: ERROR: module path does not exist: kci-new-api-job-branch-kernel-plan.js for module named: kci-new-api-job-branch-kernel-plan.js. Path is relative to: /home/kernelci", "    at /srv/staging.kernelci.org/app/dashboard/static/js/lib/r.js:26773:35"]}

@nuclearcat
Copy link
Member

Strange, but seems on second try it went thru

@gctucker
Copy link
Contributor

Thanks for this, it should be a very helpful tool during development of the new API & Pipeline as well as an extra way of prototyping things for the new web dashboard.

I would suggest to create a branch for this and host it on staging.kernelci.org with an alternative port number, so we don't risk breaking anything on the production web dashboard. Would that be OK? If so I can create the branch e.g. api-experimental and create a SysAdmin task to set up the instance.

@gctucker
Copy link
Contributor

Some notes about the API:

  • There aren't currently any kernel builds run with the new pipeline, but that's the very next step now we have KUnit and fstests running (they do their own builds under the hood) and we have the code in place for sending artifacts to storage.
  • The API hasn't been tuned at all for a web dashboard use-case, it only has primitives and the database indexes haven't really been designed yet. We could add a websocket interface to get real-time updates from the API, as well as extra API entry points to make things easier with queries that return data in an efficient way for a web dashboard. It's a bit premature to do all this right now but it's useful to keep in mind we'll need it at some point while we're adding new data schema and features etc.
  • Please keep track of any ideas and improvements you might have while working on this, even if they don't seem realistic or useful. Any kind of brainstorming is good at this stage in preparation for making some plans about the new web dashboard. Feel free to create some GitHub issues or add comments to the on-going discussion. This can include suggestions about how to evolve the API for a web dashboard use-case.

@gctucker
Copy link
Contributor

One thought, if you have some time to spend on this: as a follow-up it would be nice to have a login page since we already have user accounts with the new API. It's using OAuth2 with JWT tokens, so I believe there are standard libraries to cover the implementation and we just need a basic web form to interact with the users. See the API docs for more details.

@mgalka mgalka added the staging-skip Don't test automatically on staging.kernelci.org label Dec 19, 2022
@mgalka
Copy link

mgalka commented Dec 19, 2022

Putting staging-skip label as it looks there are some issues with deploying this changes to staging

add a new page to interact with the new Kernel CI API
and show all tests for a given test plans considering a
combination of job, branch and kernel.

- add view-new-api-job-branch-kernel-plan.2022.11.js with all logic
behing getting data from Kernel CI API and showing on html file.
- add links from /view-new-api-job-branch-kernel URL to this new view.
- add new html file to with scrips to the new route
new-api-job-branch-kernel-plan.
- add the URL rule with job, branch, kernel and plan information.

Signed-off-by: Alexandra Pereira <alexandra.pereira@collabora.com>
@alexandrasp alexandrasp force-pushed the connect-new-api-to-old-dashboard branch from 1186feb to 89f9672 Compare December 19, 2022 16:26
@alexandrasp
Copy link
Author

Thanks for this, it should be a very helpful tool during development of the new API & Pipeline as well as an extra way of prototyping things for the new web dashboard.

I would suggest to create a branch for this and host it on staging.kernelci.org with an alternative port number, so we don't risk breaking anything on the production web dashboard. Would that be OK? If so I can create the branch e.g. api-experimental and create a SysAdmin task to set up the instance.

Thanks, @gctucker. I believe this is the best alternative. Keep a separate branch with these experimental changes.

@alexandrasp
Copy link
Author

One thought, if you have some time to spend on this: as a follow-up it would be nice to have a login page since we already have user accounts with the new API. It's using OAuth2 with JWT tokens, so I believe there are standard libraries to cover the implementation and we just need a basic web form to interact with the users. See the API docs for more details.

I will create a ticket to have this in mind for next year so I can discuss it with Gustavo Padovan, and we can decide together how much effort is to put into this.

@alexandrasp alexandrasp removed the staging-skip Don't test automatically on staging.kernelci.org label Dec 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants