-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yml
69 lines (65 loc) · 2.55 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
name: 'stackql-assert'
description: 'Run StackQL query to test and audit your infrastructure.'
author: 'Yuncheng Yang, StackQL Studios'
inputs:
test_query:
description: 'StackQL query to execute (supply either test_query or test_query_file_path)'
required: false
test_query_file_path:
description: 'StackQL query file to execute (supply either test_query or test_query_file_path)'
required: false
data_file_path:
description: 'Path to data file to pass to the StackQL query preprocessor (JSON or Jsonnet file)'
required: false
vars:
description: 'Comma delimited list of variables to pass to the StackQL query preprocessor (supported with Jsonnet config blocks or Jsonnet data files only)'
required: false
expected_rows:
description: 'Expected number of rows from executing test query'
required: false
expected_results_str:
description: 'Expected result (as a JSON string) from executing test query, overrides expected_results_file_path'
required: false
expected_results_file_path:
description: 'JSON file with the expected result'
required: false
auth_obj_path:
description: 'Path of JSON file that stores StackQL AUTH string (only required when using non-standard environment variable names)'
required: false
auth_str:
description: 'StackQL AUTH string (only required when using non-standard environment variable names)'
required: false
runs:
using: "composite"
steps:
- name: Setup StackQL
uses: stackql/[email protected]
with:
use_wrapper: true
- name: Execute StackQL Command
id: exec-query
uses: stackql/[email protected]
with:
query: ${{ inputs.test_query }}
query_file_path: ${{ inputs.test_query_file_path }}
data_file_path: ${{ inputs.data_file_path }}
vars: ${{ inputs.vars }}
auth_obj_path: ${{ inputs.auth_obj_path }}
auth_str: ${{ inputs.auth_str }}
dry_run: false
- name: Check Results
uses: actions/[email protected]
with:
script: |
const path = require('path');
const assertPath = path.join(process.env.GITHUB_ACTION_PATH, 'lib', 'assert.js')
const {assertResult} = require(assertPath)
assertResult(core)
env:
RESULT: ${{ steps.exec-query.outputs.stackql-query-results }}
EXPECTED_RESULTS_STR: ${{ inputs.expected_results_str }}
EXPECTED_RESULTS_FILE_PATH: ${{ inputs.expected_results_file_path }}
EXPECTED_ROWS: ${{ inputs.expected_rows }}
branding:
icon: 'terminal'
color: 'blue'