Repository navigation
70 lines (59 loc) · 2.54 KB
/
Copy pathstackql-assert.yml
File metadata and controls
70 lines (59 loc) · 2.54 KB
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
name: 'StackQL Assert'
on:
push:
branches:
- main
pull_request:
jobs:
stackql-exec-google-example:
runs-on: ubuntu-latest
name: 'Assert test '
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Prep Google Creds (Windows)
if: ${{ matrix.os == 'windows-latest'}}
run: | ## use the secret to create json file
$GoogleCreds = [System.Environment]::GetEnvironmentVariable("GOOGLE_CREDS_ENV")
$GoogleCredsDecoded = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($GoogleCreds))
Write-Output $GoogleCredsDecoded | Set-Content sa-key.json
shell: pwsh
env:
GOOGLE_CREDS_ENV: ${{ secrets.GOOGLE_CREDS }}
- name: Prep Google Creds (bash)
if: ${{ matrix.os != 'windows-latest' }}
shell: bash
run: | ## use the base64 encoded secret to create json file
sudo echo ${{ secrets.GOOGLE_CREDS }} | base64 -d > sa-key.json
- name: query test statement example with auth_obj_path
uses: ./
with:
auth_obj_path: './stackql_scripts/auth.json'
test_query: |
REGISTRY PULL google v23.01.00116;
SELECT name, status
FROM google.compute.instances
WHERE project = 'stackql-demo' AND zone = 'australia-southeast1-a' AND name = 'stackql-demo-001';
expected_results: ' [{"name":"stackql-demo-001","status":"TERMINATED"}]'
- name: query test file example with auth_obj_path
uses: ./
with:
auth_obj_path: './stackql_scripts/auth.json'
test_query_file_path: './stackql_scripts/google-example.iql'
expected_results: ' [{"name":"stackql-demo-001","status":"TERMINATED"}]'
- name: query test statement example with auth string
uses: ./
with:
auth_str: '{ "google": { "type": "service_account", "credentialsfilepath": "sa-key.json" }}'
test_query: |
REGISTRY PULL google v23.01.00116;
SELECT name, status
FROM google.compute.instances
WHERE project = 'stackql-demo' AND zone = 'australia-southeast1-a' AND name = 'stackql-demo-001';
expected_results: ' [{"name":"stackql-demo-001","status":"TERMINATED"}]'
- name: query test file example with auth string
uses: ./
with:
auth_str: '{ "google": { "type": "service_account", "credentialsfilepath": "sa-key.json" }}'
test_query_file_path: './stackql_scripts/google-example.iql'
expected_results: ' [{"name":"stackql-demo-001","status":"TERMINATED"}]'