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

Exit with error code when encountering errors + readable log in GitHub Action #161

Closed
3 tasks done
sp-aaflalo opened this issue Jul 29, 2024 · 3 comments
Closed
3 tasks done
Assignees
Labels
bug Something isn't working

Comments

@sp-aaflalo
Copy link

First Stop

  • I have read and agreed to the ThoughtSpot Dev Tools EULA.
  • I understand that if I have a critical issue with ThoughtSpot, I should reach out to my designated Account Executive and Solutions Consultant team instead of cs_tools.
  • I searched the cs_tools documentation, with the integrated search.

Platform Configuration

╭──────────────────────────────────────────────────────────────────────────────╮
│                                                                              │
│           Info snapshot taken on 2024-07-29                                  │
│                                                                              │
│               CS Tools: 1.5.9                                                │
│         Python Version: Python 3.12.4 (main, Jul 15 2024, 21:50:45) [GCC     │
│    11.4.0]                                                                   │
│            System Info: Linux (detail:                                       │
│    Linux-6.5.0-1024-azure-x86_64-with-glibc2.35)                             │
│      Configs Directory: /home/ {anonymous} /.config/cs_tools                 │
│    Activate VirtualEnv: source                                               │
│    "/opt/hostedtoolcache/Python/3.12.4/x64/bin/activate"                     │
│     System Python Path: /opt/hostedtoolcache/Python/3.12.4/x64/bin/python    │
│          Platform Tags: linux-x86_64                                         │
│                                                                              │
╰──────────────────────────────────────────────────────────────────────────────╯

Description

Couple of annoyance with the CLI tool:

  1. Doesn't return an exit error code like -1 on any encountered error.
  2. When error are triggered, they can't be read inside the log of the github action
┏━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
┃ File Name              ┃ Status ┃ Message                                     
┡━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
│ 21b98abf-8fa5-43d5-b7… │ ERROR  │ Visualization <b> Viz_1 </b> has following e
│                        │        │ <b>NAME_OF_LIVEBOARD</b><br/><b
│                        │        │ 21653e13-6c[17](https://github.com/XXX/XXX/actions/runs/XXX/job/XXXX#step:5:18)-44db-8372-62a983d44f0a found f
└────────────────────────┴────────┴─────────────────────────────────────────────

It makes the tool hard to use in the context of a CI/CD.

Need to upload log files securely?

No response

@sp-aaflalo sp-aaflalo added the bug Something isn't working label Jul 29, 2024
@sp-aaflalo sp-aaflalo changed the title Exit with error code when encountering errors Exit with error code when encountering errors + readable log in GitHub Action Jul 29, 2024
@boonhapus boonhapus self-assigned this Jul 29, 2024
@boonhapus
Copy link
Collaborator

boonhapus commented Jul 29, 2024

@sp-aaflalo ACK on this one -- let me sync with the author of this tool on when this can be improved.

Will put it in the next release as well, but will the changes will involve using logging as opposed to stdout for warnings/errors .. the nonzero error code is partially a byproduct of the current alerting approach in this tool, so that should get fixed as well. Generally, if an error occurs, we should be returning a 1 for error state (known or unknown errors), or a 0 for success.

@sp-aaflalo
Copy link
Author

Thanks for implementing proper error code (and yes, 1 not -1, thanks for the correction).

About logging, only command I can find relating to it is cs_tools logs report but that doesn't provide any error in the log, only the log of the request etc ...

Is there another settings to get a log file with errors ?

@boonhapus
Copy link
Collaborator

This is something that will need to be changed in the tool's code itself. Right now, a lot of the output it going to terminal stdout (eg. printing it) instead of logged stdout. The update should bring this tool back in line with logging relevant info, rather than printing it.

cs_tools logs report --latest K <path> simply copies K number of files from /home/ {anonymous} /.config/cs_tools/.logs to the path that you specify in <path>.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants