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

Safely providing logging output from failed hub health checks #585

Closed
sgibson91 opened this issue Aug 6, 2021 · 7 comments · Fixed by #601
Closed

Safely providing logging output from failed hub health checks #585

sgibson91 opened this issue Aug 6, 2021 · 7 comments · Fixed by #601
Labels
Task Actions that don't involve changing our code or docs.

Comments

@sgibson91
Copy link
Member

sgibson91 commented Aug 6, 2021

Summary

At the moment, our hub health checks in deployer only output pass or fail, without any indication to what caused the failure. This is because when pytest fails like this, it exposes any secrets on the command line. At the minute to diagnose the failure, we have to get the logs directly from the hub pod. Which is fine, but if you don't already have access to the clusters setup, it can be disruptive to flow.

We should think about safe ways for the deployer to provide feedback when a hub health check fails.

@sgibson91 sgibson91 added the Task Actions that don't involve changing our code or docs. label Aug 6, 2021
@yuvipanda
Copy link
Member

This would be great help. The problem is that pytest fails with showing all params, which include secrets. I think we can safely move away from pytest maybe - I don't think we use any of its features at all

@sgibson91
Copy link
Member Author

The problem is that pytest fails with showing all params, which include secrets.

Ah yes, thank you. Updating top comment.

@sgibson91
Copy link
Member Author

Can you remind me what the undesired output looks like? Is it just the options defined in conftest.py are printed out at the top of the output and the api_token in-particular is sensitive? That is we get something like the below before the pytest feedback:

hub_url = https://example.com
hub_type = basehub
api_token = SUPER_SECRET_VALUE

@sgibson91
Copy link
Member Author

Or better yet, if there's a way I can locally force a failed test without actually deploying anything - that would be grand 😁

@sgibson91
Copy link
Member Author

sgibson91 commented Aug 6, 2021

If my above assumption is correct, I think "all" we have to do is add --tb=short to the pytest invocation and the input parameters are suppressed and the expense of slightly shortening the rest of pytest's output

https://github.com/2i2c-org/pilot-hubs/blob/b4244164aa7a526ef5d6df1e7fb0d167ace567b8/deployer/hub.py#L419-L425

@sgibson91
Copy link
Member Author

See minimal working example here https://gist.github.com/sgibson91/5b31ee1b18832ae785565da99fe605a2

@damianavila
Copy link
Contributor

and the input parameters are suppressed and the expense of slightly shortening the rest of pytest's output

I think it is a good enough compromise...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Task Actions that don't involve changing our code or docs.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants