Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 22 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand All @@ -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`)

Expand Down
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
15 changes: 14 additions & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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") {
Expand Down Expand Up @@ -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);
Expand Down
18 changes: 17 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ interface Params {
organization?: string | null;
environment?: string | null;
token?: string | null;
telemetryEnabled: boolean;
}

const params: Params = {
Expand All @@ -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";
Expand Down Expand Up @@ -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);