Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
1f7adc5
added check instances example in test
yunchengyang515 Mar 1, 2023
98a7fba
change to auth obj path
yunchengyang515 Mar 1, 2023
79f498b
added an extra stackql-exec step
yunchengyang515 Mar 1, 2023
e773e69
added an extra stackql-exec step
yunchengyang515 Mar 1, 2023
7670095
added an extra stackql-exec step
yunchengyang515 Mar 1, 2023
2cb1491
created new workflow for demo fixing
yunchengyang515 Mar 1, 2023
dee0ff0
created new workflow for demo fixing
yunchengyang515 Mar 1, 2023
9e361ee
created new workflow for demo fixing
yunchengyang515 Mar 1, 2023
e264afa
created new workflow for demo fixing
yunchengyang515 Mar 1, 2023
7388101
created new workflow for demo fixing
yunchengyang515 Mar 1, 2023
46cdb00
use local to reproduce error
yunchengyang515 Mar 1, 2023
4c6ebfb
try the check file in other workflow, to rule on potential issue with…
yunchengyang515 Mar 2, 2023
f9e7499
added registry pull
yunchengyang515 Mar 2, 2023
8da33c8
try use another query
yunchengyang515 Mar 2, 2023
2b70baa
removing previous stackql steps
yunchengyang515 Mar 2, 2023
231c043
change the query content
yunchengyang515 Mar 2, 2023
2ed2ec3
trying with base64 creds
yunchengyang515 Mar 2, 2023
3db0045
remove env{}
yunchengyang515 Mar 2, 2023
1d5734c
try to use same setup as stackql-assert example
yunchengyang515 Mar 2, 2023
f378342
adding back other stackql queries
yunchengyang515 Mar 2, 2023
202da4c
change back the creds
yunchengyang515 Mar 2, 2023
d7f4f59
remove stackql steps
yunchengyang515 Mar 2, 2023
9cd8e62
use old demo
yunchengyang515 Mar 2, 2023
bab8f5b
try exec only
yunchengyang515 Mar 2, 2023
c8b6383
fix the demo creds variable name
yunchengyang515 Mar 2, 2023
57d2403
only run check instance
yunchengyang515 Mar 2, 2023
d8869b9
only remove deploy step
yunchengyang515 Mar 2, 2023
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
8 changes: 7 additions & 1 deletion .github/workflows/stackql-assert.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ jobs:
auth_str: '{ "google": { "type": "service_account", "credentialsfilepath": "sa-key.json" }}'
test_query_file_path: './.github/workflows/workflow_scripts/google-example.iql'
expected_rows: 1


- name: check if we have 4 instances using stackql-assert from local
uses: ./
with:
auth_obj_path: './.github/workflows/workflow_scripts/auth.json'
test_query_file_path: './.github/workflows/workflow_scripts/check-instances.iql'
expected_rows: 1


61 changes: 61 additions & 0 deletions .github/workflows/stackql-demo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Demo of stackql-exec and stackql-assert

on:
push:
branches:
- main
pull_request:
workflow_dispatch:

jobs:
stackql-exec-job:
name: stackql-exec-job
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
name: "[SETUP] checkout repo"

- name: prep Google creds
env:
GOOGLE_CREDS: ${{ secrets.GOOGLE_DEMO_CREDS }}
shell: bash
run: |
sudo echo $GOOGLE_CREDS > sa-key.json

- name: pull Google docs
uses: stackql/stackql-exec@v1.0.1
with:
auth_obj_path: ./.github/workflows/workflow_scripts/auth.json
query: "REGISTRY PULL google"

- name: dry run StackQL query
shell: bash
run: |
stackql exec -i ./.github/workflows/workflow_scripts/deploy-instances.iql --output text -H --dryrun

# - name: deploy instances using stackql-exec
# uses: stackql/stackql-exec@v1.0.1
# with:
# auth_obj_path: './.github/workflows/workflow_scripts/auth.json'
# query_file_path: './.github/workflows/workflow_scripts/deploy-instances.iql'

- name: stop running instances using stackql-exec
uses: stackql/stackql-exec@v1.0.1
with:
auth_obj_path: './.github/workflows/workflow_scripts/auth.json'
query_file_path: './.github/workflows/workflow_scripts/stop-instances.iql'

- name: check if we have 4 instances using stackql-assert from local
uses: ./
with:
auth_obj_path: './.github/workflows/workflow_scripts/auth.json'
test_query_file_path: './.github/workflows/workflow_scripts/check-instances.iql'
expected_rows: 4

# - name: check if we have 4 instances using stackql-assert on marketplace
# uses: stackql/stackql-assert@v1.0.2
# with:
# auth_obj_path: './.github/workflows/workflow_scripts/auth.json'
# test_query_file_path: './.github/workflows/workflow_scripts/check-instances.iql'
# expected_rows: 4
7 changes: 6 additions & 1 deletion .github/workflows/workflow_scripts/auth.json
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
{ "google": { "type": "service_account", "credentialsfilepath": "sa-key.json" }}
{
"google": {
"type": "service_account",
"credentialsfilepath": "sa-key.json"
}
}
12 changes: 12 additions & 0 deletions .github/workflows/workflow_scripts/check-instances.iql
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<<<jsonnet
{
project: 'stackql-demo-2',
zone: 'australia-southeast1-b',
nameLike: 'actions-test-',
}
>>>
SELECT id, name
FROM google.compute.instances
WHERE project = '{{.project}}'
AND zone = '{{.zone}}'
AND name LIKE '{{.nameLike}}%';
45 changes: 45 additions & 0 deletions .github/workflows/workflow_scripts/deploy-instances.iql
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<<<jsonnet
{
project: 'stackql-demo-2',
zone: 'australia-southeast1-b',
networkInterfaces: [{"subnetwork":"https://www.googleapis.com/compute/v1/projects/stackql-demo-2/regions/australia-southeast1/subnetworks/default"}],
disks: [{"autoDelete":true,"boot":true,"initializeParams":{"diskSizeGb":"10","sourceImage":"https://compute.googleapis.com/compute/v1/projects/ubuntu-os-cloud/global/images/family/ubuntu-2004-lts"},"mode":"READ_WRITE","type":"PERSISTENT"}],
instances: [
{
name: 'actions-test-1',
machineType: 'https://www.googleapis.com/compute/v1/projects/stackql-demo-2/zones/australia-southeast1-b/machineTypes/e2-micro',
},
{
name: 'actions-test-2',
machineType: 'https://www.googleapis.com/compute/v1/projects/stackql-demo-2/zones/australia-southeast1-b/machineTypes/f1-micro',
},
{
name: 'actions-test-3',
machineType: 'https://www.googleapis.com/compute/v1/projects/stackql-demo-2/zones/australia-southeast1-b/machineTypes/e2-micro',
},
{
name: 'actions-test-4',
machineType: 'https://www.googleapis.com/compute/v1/projects/stackql-demo-2/zones/australia-southeast1-b/machineTypes/f1-micro',
},
]
}
>>>
{{ $root := . }}
{{range $root.instances}}
INSERT INTO google.compute.instances(
project,
zone,
data__name,
data__machineType,
data__disks,
data__networkInterfaces
)
SELECT
'{{$root.project}}' as project,
'{{$root.zone}}' as zone,
'{{.name}}' as name,
'{{.machineType}}' as machineType,
'{{$root.disks}}' as disks,
'{{$root.networkInterfaces}}' as networkInterfaces
;
{{end}}
27 changes: 27 additions & 0 deletions .github/workflows/workflow_scripts/stop-instances.iql
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<<<jsonnet
{
project: 'stackql-demo-2',
zone: 'australia-southeast1-b',
instances: [
{
name: 'actions-test-1',
},
{
name: 'actions-test-2',
},
{
name: 'actions-test-3',
},
{
name: 'actions-test-4',
},
]
}
>>>
{{ $root := . }}
{{range $root.instances}}
EXEC google.compute.instances.stop
@instance='{{.name}}',
@project='{{$root.project}}',
@zone='{{$root.zone}}';
{{end}}
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
node_modules
node_modules
.stackql