diff --git a/README.md b/README.md index 652a294..0c59dea 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,8 @@ Use it to install Testkube CLI to manage your resources, run tests and test suit 2. [Self-hosted instance](#self-hosted-instance) 3. [Examples](#examples) 1. [Run a test on AWS EKS](#run-a-test-on-aws-eks) - 2. [Run a test on the Pro instance](#run-a-test-on-the-pro-instance) + 2. [Run a test with telemetry disabled](#run-a-test-with-telemetry-disabled) + 3. [Run a test on the Pro instance](#run-a-test-on-the-pro-instance) 2. [Inputs](#inputs) 1. [Common](#common) 2. [Kubernetes (`kubectl`)](#kubernetes-kubectl) @@ -105,6 +106,21 @@ steps: testkube run test some-test-name -f ``` +#### Run a test with telemetry disabled + +```yaml +steps: + # Setup Testkube with telemetry disabled + - uses: kubeshop/setup-testkube@v1 + with: + namespace: default + telemetry-enabled: false + + # Use CLI with a shell script + - run: | + testkube run test some-test-name -f +``` + #### Run a test on the Pro instance ```yaml @@ -127,10 +143,11 @@ Besides common inputs, there are some different for kubectl and Pro connection. ### Common -| Required | Name | Description | -|:--------:|-------------------|------------------------------------------------------------------------------------------------------------------------------| -| ✗ | `channel` | Distribution channel to install the latest application from - one of `stable` or `beta` (default: `stable`) | -| ✗ | `version` | Static Testkube CLI version to force its installation instead of the latest | +| Required | Name | Description | +|:--------:|--------------------|------------------------------------------------------------------------------------------------------------------------------| +| ✗ | `channel` | Distribution channel to install the latest application from - one of `stable` or `beta` (default: `stable`) | +| ✗ | `version` | Static Testkube CLI version to force its installation instead of the latest | +| ✗ | `telemetry-enabled`| Enable or disable Testkube telemetry (default: `true`) | ### Kubernetes (`kubectl`) diff --git a/action.yml b/action.yml index 6a21721..09f31db 100644 --- a/action.yml +++ b/action.yml @@ -46,3 +46,7 @@ inputs: token: description: "Auth token for the Testkube instance." required: false + telemetry-enabled: + description: "Enable or disable Testkube telemetry (default: true)." + required: false + default: "true" diff --git a/dist/index.js b/dist/index.js index a0cbe1c..9de915c 100644 --- a/dist/index.js +++ b/dist/index.js @@ -35024,6 +35024,7 @@ const params = { organization: (0,_actions_core__WEBPACK_IMPORTED_MODULE_5__.getInput)("organization"), environment: (0,_actions_core__WEBPACK_IMPORTED_MODULE_5__.getInput)("environment"), token: (0,_actions_core__WEBPACK_IMPORTED_MODULE_5__.getInput)("token"), + telemetryEnabled: (0,_actions_core__WEBPACK_IMPORTED_MODULE_5__.getInput)("telemetry-enabled") !== "false", }; const mode = params.organization || params.environment || params.token ? "cloud" : "kubectl"; if (mode === "cloud") { @@ -35177,7 +35178,19 @@ const contextArgs = mode === "kubectl" ...(params.urlUiSubdomain ? ["--ui-prefix", params.urlUiSubdomain] : []), ...(params.urlLogsSubdomain ? ["--logs-prefix", params.urlLogsSubdomain] : []), ]; -process.exit((0,node_child_process__WEBPACK_IMPORTED_MODULE_0__.spawnSync)("testkube", ["set", "context", ...contextArgs], { stdio: "inherit" }).status || 0); +const contextResult = (0,node_child_process__WEBPACK_IMPORTED_MODULE_0__.spawnSync)("testkube", ["set", "context", ...contextArgs], { stdio: "inherit" }); +if (contextResult.status !== 0) { + process.exit(contextResult.status || 1); +} +// Disable telemetry if requested +if (!params.telemetryEnabled) { + process.stdout.write("Disabling telemetry...\n"); + const telemetryResult = (0,node_child_process__WEBPACK_IMPORTED_MODULE_0__.spawnSync)("testkube", ["disable", "telemetry"], { stdio: "inherit" }); + if (telemetryResult.status !== 0) { + process.exit(telemetryResult.status || 1); + } +} +process.exit(0); __webpack_async_result__(); } catch(e) { __webpack_async_result__(e); } }, 1); diff --git a/src/index.ts b/src/index.ts index d0ad6d8..2791f18 100644 --- a/src/index.ts +++ b/src/index.ts @@ -22,6 +22,7 @@ interface Params { organization?: string | null; environment?: string | null; token?: string | null; + telemetryEnabled: boolean; } const params: Params = { @@ -35,6 +36,7 @@ const params: Params = { organization: getInput("organization"), environment: getInput("environment"), token: getInput("token"), + telemetryEnabled: getInput("telemetry-enabled") !== "false", }; const mode = params.organization || params.environment || params.token ? "cloud" : "kubectl"; @@ -218,4 +220,18 @@ const contextArgs = ...(params.urlLogsSubdomain ? ["--logs-prefix", params.urlLogsSubdomain] : []), ]; -process.exit(spawnSync("testkube", ["set", "context", ...contextArgs], { stdio: "inherit" }).status || 0); +const contextResult = spawnSync("testkube", ["set", "context", ...contextArgs], { stdio: "inherit" }); +if (contextResult.status !== 0) { + process.exit(contextResult.status || 1); +} + +// Disable telemetry if requested +if (!params.telemetryEnabled) { + process.stdout.write("Disabling telemetry...\n"); + const telemetryResult = spawnSync("testkube", ["disable", "telemetry"], { stdio: "inherit" }); + if (telemetryResult.status !== 0) { + process.exit(telemetryResult.status || 1); + } +} + +process.exit(0);