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

[WIP] Print JSON status of preflight checks #2984

Closed
wants to merge 3 commits into from

Conversation

anjannath
Copy link
Member

@anjannath anjannath commented Feb 3, 2022

Fixes #2935

This is based on the initial changes done by @cfergeau at cfergeau@447677b

## o/p of `crc setup`
PS C:\Users\anath\redhat\crc> crc setup --json-stream 2> txt
{
  "type": "check",
  "description": "Checking if current user is in Hyper-V Admins group",
  "result": "passed",
  "error": null
}
{
  "type": "check",
  "description": "Checking if CRC bundle is extracted in '$HOME/.crc'",
  "result": "failed",
  "error": {}
}
{
  "totalBytes": 650263232,
  "completedBytes": 255386044
}
{
  "totalBytes": 650263232,
  "completedBytes": 257664726
}
{
  "totalBytes": 650263232,
  "completedBytes": 260318934
}

@openshift-ci
Copy link

openshift-ci bot commented Feb 3, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: anjannath

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved label Feb 3, 2022
@anjannath
Copy link
Member Author

Please ignore the CI failure for now, is related to gofmt since am on windows these tools don't work properly

@anjannath anjannath force-pushed the issue_2935 branch 2 times, most recently from 1b37889 to 4f3a33a Compare February 3, 2022 07:41
@gbraad
Copy link
Contributor

gbraad commented Feb 3, 2022

Steps need to be identified by a number, especially a list of all these steps by name.
Else it is hard to relate what the deltas are for.

@anjannath
Copy link
Member Author

Steps need to be identified by a number, especially a list of all these steps by name. Else it is hard to relate what the deltas are for.

right now for every check/step this is the information that we get, you want an id to be included here that increments for step, what else should be included here?

{
  "type": "check",
  "description": "Checking if current user is in Hyper-V Admins group",
  "result": "passed",
  "error": null
}

for the download, we get the total size and the currently downloaded size, which can be used for the progress bar on the tray.

can you provide example of what should be the JSON o/p for crc setup --json-stream be?

@gbraad
Copy link
Contributor

gbraad commented Feb 3, 2022

something like:

{
  "total": 20
},
{
  "id": 14.
  "type": "check",
  "description": "Checking if current user is in Hyper-V Admins group",
  "result": "passed",
  "error": null
}
{
  "id": 15,
  "type": "task",
  "description": "Downloading bundle",
},
{
  "belongto": 15,
  "totalBytes": 650263232,
  "completedBytes": 255386044
}

cfergeau and others added 2 commits February 7, 2022 15:40
the idea is to use this structured o/p of preflight
checks in the tray to show details to the user

since our logging package writes to stderr only, if
we only read stdout from the setup command while running
in the tray then we get valid json
like the previous commit, this also prints the json o/p
on stdout
@anjannath
Copy link
Member Author

@gbraad this is the updated o/p, not yet able to relate the download stats with the preflight check id, also in the code fix is part of the check struct, so even though the id is incremented, (since it only exists in the json printing part) the total key shows the no. of Check{} s

PS C:\Users\anath\redhat\crc> crc setup --check-only --json-stream 2> txt
{
  "total": 2
}
{
  "id": 1,
  "type": "check",
  "description": "Checking if current user is in Hyper-V Admins group",
  "result": "passed",
  "error": null
}
{
  "id": 2,
  "type": "check",
  "description": "Checking if CRC bundle is extracted in '$HOME/.crc'",
  "result": "failed",
  "error": {}
}

PS C:\Users\anath\redhat\crc> crc setup --json-stream 2> txt
{
  "total": 2
}
{
  "id": 1,
  "type": "check",
  "description": "Checking if current user is in Hyper-V Admins group",
  "result": "passed",
  "error": null
}
{
  "id": 2,
  "type": "check",
  "description": "Checking if CRC bundle is extracted in '$HOME/.crc'",
  "result": "failed",
  "error": {}
}
{
  "id": 3,
  "type": "fix",
  "description": "Getting bundle for the CRC executable",
  "result": "",
  "error": null
}
{
  "filename": "C:\\Users\\anath\\.crc\\cache\\crc_podman_hyperv_3.4.4.crcbundle",
  "totalBytes": 650263232,
  "completedBytes": 446963712
}

@gbraad gbraad changed the title [wip] Print JSON status of preflight checks [WIP] Print JSON status of preflight checks Feb 11, 2022
@gbraad
Copy link
Contributor

gbraad commented Feb 16, 2022

Changing this to be newline delimited and add more information to the actual download message:

{"total": 26}
{"id":1,"type":"check","description":"Checking if running as non-root","result":"passed","error":null}
{"id":2,"type":"check","description":"Checking if running inside WSL2","result":"passed","error":null}
{"id":3,"type":"check","description":"Checking if crc-admin-helper executable is cached","result":"passed","error":null}
{"id":4,"type":"check","description":"Checking for obsolete admin-helper executable","result":"passed","error":null}
{"id":5,"type":"check","description":"Checking if running on a supported CPU architecture","result":"passed","error":null}
{"id":6,"type":"check","description":"Checking minimum RAM requirements","result":"passed","error":null}
{"id":7,"type":"check","description":"Checking if crc executable symlink exists","result":"passed","error":null}
{"id":8,"type":"check","description":"Checking if Virtualization is enabled","result":"passed","error":null}
{"id":9,"type":"check","description":"Checking if KVM is enabled","result":"passed","error":null}
{"id":10,"type":"check","description":"Checking if libvirt is installed","result":"passed","error":null}
{"id":11,"type":"check","description":"Checking if user is part of libvirt group","result":"passed","error":null}
{"id":12,"type":"check","description":"Checking if active user/process is currently part of the libvirt group","result":"passed","error":null}
{"id":13,"type":"check","description":"Checking if libvirt daemon is running","result":"passed","error":null}
{"id":14,"type":"check","description":"Checking if a supported libvirt version is installed","result":"passed","error":null}
{"id":15,"type":"check","description":"Checking if crc-driver-libvirt is installed","result":"passed","error":null}
{"id":16,"type":"check","description":"Checking crc daemon systemd service","result":"passed","error":null}
{"id":17,"type":"check","description":"Checking crc daemon systemd socket units","result":"passed","error":null}
{"id":18,"type":"check","description":"Checking if systemd-networkd is running","result":"passed","error":null}
{"id":19,"type":"check","description":"Checking if NetworkManager is installed","result":"passed","error":null}
{"id":20,"type":"check","description":"Checking if NetworkManager service is running","result":"passed","error":null}
{"id":21,"type":"check","description":"Checking if dnsmasq configurations file exist for NetworkManager","result":"passed","error":null}
{"id":22,"type":"check","description":"Checking if the systemd-resolved service is running","result":"passed","error":null}
{"id":23,"type":"check","description":"Checking if /etc/NetworkManager/dispatcher.d/99-crc.sh exists","result":"passed","error":null}
{"id":24,"type":"check","description":"Checking if libvirt 'crc' network is available","result":"passed","error":null}
{"id":25,"type":"check","description":"Checking if libvirt 'crc' network is active","result":"passed","error":null}
{"id":26,"type":"check","description":"Checking if CRC bundle is extracted in '$HOME/.crc'","result":"failed","error":{}}
{"type":"download","filename":"/home/gbraad/.crc/cache/crc_podman_libvirt_3.4.4.crcbundle","totalBytes":649600569,"completedBytes":7437096}
{"type":"download","filename":"/home/gbraad/.crc/cache/crc_podman_libvirt_3.4.4.crcbundle","totalBytes":649600569,"completedBytes":33323816}
{"type":"download","filename":"/home/gbraad/.crc/cache/crc_podman_libvirt_3.4.4.crcbundle","totalBytes":649600569,"completedBytes":58620712}
{"type":"download","filename":"/home/gbraad/.crc/cache/crc_podman_libvirt_3.4.4.crcbundle","totalBytes":649600569,"completedBytes":84769576}

@gbraad gbraad self-assigned this Feb 16, 2022
@gbraad gbraad linked an issue Feb 16, 2022 that may be closed by this pull request
@gbraad gbraad mentioned this pull request Feb 16, 2022
4 tasks
@gbraad
Copy link
Contributor

gbraad commented Feb 16, 2022

Ideally this needs the step streamed BEFORE the result is known, and followed by the actual state is finished (passed/failed)

@openshift-ci
Copy link

openshift-ci bot commented Mar 1, 2022

@anjannath: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/images 43efb22 link true /test images
ci/prow/e2e-crc 43efb22 link true /test e2e-crc
ci/prow/integration-crc 43efb22 link true /test integration-crc

Full PR test history. Your PR dashboard.

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/test-infra repository. I understand the commands that are listed here.

@stale
Copy link

stale bot commented Apr 30, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the status/stale Issue went stale; did not receive attention or no reply from the OP label Apr 30, 2022
@stale stale bot closed this Jun 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved do-not-merge/work-in-progress status/stale Issue went stale; did not receive attention or no reply from the OP
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Spike streaming JSON for crc setup.
3 participants