thoughtspot / cs_tools

Scale your ThoughtSpot adoption with tools created by the ThoughtSpot Solutions Consulting organization.
https://thoughtspot.github.io/cs_tools/
Other
8 stars 6 forks source link

Can't create a config in a github action because of prompting for telemetry #160

Closed sp-aaflalo closed 1 month ago

sp-aaflalo commented 1 month ago

First Stop

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"                     │
│          Platform Tags: linux-x86_64                                         │
│                                                                              │
╰──────────────────────────────────────────────────────────────────────────────╯

Description

I'm trying to do something like this in my GitHub action: cs_tools config create --config "default" --default --url "***" --username "***" --secret "***"

But it keeps failing because of the telemetry prompt that I can't answer (even tried yes "no" | COMMAND).

╭─────────── Would you like to send analytics to the CS Tools team? ───────────╮
│ We use this information to help the ThoughtSpot Product team prioritize new  │
│ features.                                                                    │
│                                                                              │
│ - CS Tools Environment UUID      - CS Tools Version                          │
│ - Today's Date                   - Your Operating System (Windows, Mac,      │
│ Linux)                                                                       │
│ - Python Platform Tag            - Python Version                            │
│ - Whether or not you run CS Tools on the ThoughtSpot cluster                 │
╰──────────────────────────────────────────────────────────────────────────────╯

  Response [yes/no/prompt]: 

This is quite annoying, is there a way for me to answer that prompt thought an argument of the command ?

Need to upload log files securely?

No response

boonhapus commented 1 month ago

@sp-aaflalo can you try using environment variables instead of trying to create a config?

Here's an example from this repo directly.

https://github.com/thoughtspot/cs_tools/blob/4c4a814d96b255f9b19bd194b91497ae6e208511/.github/workflows/fetch-bi-data.yaml#L14-L17

Then in the steps, you can install CS Tools from a particular tag using python -m pip install cs_tools[cli] @ https://github.com/thoughtspot/cs_tools/archive/v1.5.9.zip"

https://github.com/thoughtspot/cs_tools/blob/4c4a814d96b255f9b19bd194b91497ae6e208511/.github/workflows/fetch-bi-data.yaml#L36-L37

Then call your commands in another step, telling CS Tools to pull config info from the environment with --config ENV:

https://github.com/thoughtspot/cs_tools/blob/4c4a814d96b255f9b19bd194b91497ae6e208511/.github/workflows/fetch-bi-data.yaml#L46-L47

sp-aaflalo commented 1 month ago

If I do that I encounter issue with cs_tools tools git tool.

Seems to be related to the order of parameter.

Also, it's because I'm creating a clean reusable action "setup-thoughspot-cli" that set the config per default. Easier for other commands later, never have to give a config.

Currently, I'm simply pre-populating the .meta-config.json with data I want.

boonhapus commented 1 month ago

@sp-aaflalo There's a bug I still haven't resolved on param ordering (#135), when the tool has an argument. For now, it's best to leave --config JKL at the end of the command.

I'll add a check to the analytics prompt for CI environments so it doesn't pop up.

boonhapus commented 1 month ago

@souravkumar93 once we release 1.5.10 , if you want to opt out of anonymous analytics (we only take anon analytics for CI environments)

you can either set it in the .meta-config.json

{
    "analytics": {
        "is_opted_in": false,
        "last_checkpoint": "2012-06-01T00:00:00+00:00",
        "can_record_url": false
    },
}

or set CS_TOOLS_ANALYTICS_OPT_OUT to any value.

sp-aaflalo commented 1 month ago

Awesome, that does make it easier to have the ENV Var !