You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The `stackql/stackql-assert` action is an composite action that runs a `stackql` query and checks if the result matches an expected result
4
6
5
7
# Usage
6
8
9
+
> This action uses the [setup-stackql](https://github.com/marketplace/actions/stackql-studios-setup-stackql) and [stackql-exec](https://github.com/marketplace/actions/stackql-studios-stackql-exec) actions
10
+
7
11
## Provider Authentication
8
12
Authentication to StackQL providers is done via environment variables source from GitHub Actions Secrets. To learn more about authentication, see the setup instructions for your provider or providers at the [StackQL Provider Registry Docs](https://stackql.io/registry).
9
13
10
14
## Inputs
11
-
-`test_query` - stackql query to execute **(need to supply either `test_query` or `test_query_file_path`)**
12
-
-`test_query_file_path` - stackql query file to execute **(need to supply either `test_query` or `test_query_file_path`)**
13
-
-`data_file_path` - (optional) path to data file to pass to the stackql query preprocessor (`json` or `jsonnet`)
14
-
-`vars` - (optional) comma delimited list of variables to pass to the stackql query preprocessor (supported with `jsonnet` config blocks or `jsonnet` data files only), accepts `var1=val1,var2=val2`, can be used to source environment variables into stackql queries
15
-
-`expected_rows` - (optional) Expected number of rows in the result.
16
-
-`expected_results_str` - (optional) Expected result (`json`) from executing test query, support object string (overrides `expected_results_file_path`)
17
-
-`expected_results_file_path` - (optional) Results file (`json`) that stores expected result, json is support
18
-
-`auth_obj_path` - (optional) the path of json file that stores stackql AUTH string **(only required when using non-standard environment variable names)**
19
-
-`auth_str` - (optional) stackql AUTH string **(only required when using non-standard environment variable names)**
15
+
-**`test_query`** - stackql query to execute *(need to supply either `test_query` or `test_query_file_path`)*
16
+
-**`test_query_file_path`** - stackql query file to execute *(need to supply either `test_query` or `test_query_file_path`)*
17
+
-**`data_file_path`** - (optional) path to data file to pass to the stackql query preprocessor (`json` or `jsonnet`)
18
+
-**`vars`** - (optional) comma delimited list of variables to pass to the stackql query preprocessor (supported with `jsonnet` config blocks or `jsonnet` data files only), accepts `var1=val1,var2=val2`, can be used to source environment variables into stackql queries
19
+
-**`expected_rows`** - (optional) Expected number of rows in the result.
20
+
-**`expected_results_str`** - (optional) Expected result (`json`) from executing test query, support object string (overrides `expected_results_file_path`)
21
+
-**`expected_results_file_path`** - (optional) Results file (`json`) that stores expected result, json is support
22
+
-**`auth_obj_path`** - (optional) the path of json file that stores stackql AUTH string *(only required when using non-standard environment variable names)*
23
+
-**`auth_str`** - (optional) stackql AUTH string *(only required when using non-standard environment variable names)*
20
24
21
25
**__NOTE:__ one of `expected_rows`, `expected_results_str` or `expected_results_file_path` is required**
22
26
@@ -28,7 +32,7 @@ Authentication to StackQL providers is done via environment variables source fro
28
32
## Expected Result
29
33
- Use `expected_results_str` or `expected_results_file_path` or `expected_rows` to pass the expected result to the action. The expected result (`expected_results_str` or `expected_results_file_path`) should be a valid `json` object. The action will compare the result with the expected result. If the result is not the same as the expected result, the action will fail the step.
30
34
- Either `expected_results_str` or `expected_results_file_path` or `expected_rows` are required. If `expected_results_str` and `expected_results_file_path` are provided, `expected_results_str` will be used.
31
-
- Expected result example can be found in [example workflow](./.github/workflows/stackql-assert.yml) and [example .json file](./.github/workflows/workflow_scripts)
35
+
- Expected result example can be found in [example workflow](./.github/workflows/stackql-assert-test.yml) and [example .json file](./.github/workflows/workflow_scripts)
32
36
33
37
## Examples
34
38
The following excerpts from a GitHub Actions workflow demonstrate how to use the `stackql/stackql-assert` action.
@@ -40,7 +44,6 @@ The following excerpts from a GitHub Actions workflow demonstrate how to use the
40
44
uses: ./
41
45
with:
42
46
test_query: |
43
-
REGISTRY PULL google;
44
47
SELECT name
45
48
FROM google.compute.instances
46
49
WHERE project = 'stackql-demo' AND zone = 'australia-southeast1-a' AND name = 'stackql-demo-001';
description: 'run StackQL query to test and audit your infrastructure.'
2
+
description: 'Run StackQL query to test and audit your infrastructure.'
3
3
author: 'Yuncheng Yang, StackQL Studios'
4
4
inputs:
5
5
test_query:
6
-
description: stackql query to execute (need to supply either test_query or test_query_file_path)
6
+
description: 'StackQL query to execute (supply either test_query or test_query_file_path)'
7
7
required: false
8
8
test_query_file_path:
9
-
description: stackql query file to execute (need to supply either test_query or test_query_file_path)
9
+
description: 'StackQL query file to execute (supply either test_query or test_query_file_path)'
10
10
required: false
11
11
data_file_path:
12
-
description: path to data file to pass to the stackql query preprocessor (json or jsonnet file)
12
+
description: 'Path to data file to pass to the StackQL query preprocessor (JSON or Jsonnet file)'
13
13
required: false
14
14
vars:
15
-
description: comma delimited list of variables to pass to the stackql query preprocessor (supported with jsonnet config blocks or jsonnet data files only), accepts 'var1=val1,var2=val2', can be used to source environment variables into stackql queries
15
+
description: 'Comma delimited list of variables to pass to the StackQL query preprocessor (supported with Jsonnet config blocks or Jsonnet data files only)'
16
16
required: false
17
-
expected_rows:
18
-
description: expected number of rows from executing test query
17
+
expected_rows:
18
+
description: 'Expected number of rows from executing test query'
19
19
required: false
20
20
expected_results_str:
21
-
description: expected result (as a json string) from executing test query, overrides expected_results_file_path
21
+
description: 'Expected result (as a JSON string) from executing test query, overrides expected_results_file_path'
22
22
required: false
23
23
expected_results_file_path:
24
-
description: json file with the expected result
24
+
description: 'JSON file with the expected result'
25
25
required: false
26
26
auth_obj_path:
27
-
description: the path of json file that stores stackql AUTH string (only required when using non-standard environment variable names)
27
+
description: 'Path of JSON file that stores StackQL AUTH string (only required when using non-standard environment variable names)'
28
28
required: false
29
29
auth_str:
30
-
description: stackql AUTH string (only required when using non-standard environment variable names)
30
+
description: 'StackQL AUTH string (only required when using non-standard environment variable names)'
31
31
required: false
32
32
33
33
runs:
34
34
using: "composite"
35
35
steps:
36
-
- name: check if stackql is installed and set output
0 commit comments