You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?
GitHub Action
stackql-exec
v1.2.1
Github Action as a wrapper for executing a single command in stackql, maps all stackql exec args to actions args
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.
- name: exec github example
uses: ./
with:
query: "REGISTRY PULL github;
SHOW PROVIDERS;
select total_private_repos
from github.orgs.orgs
where org = 'stackql';"
env:
STACKQL_GITHUB_USERNAME: ${{ secrets.STACKQL_GITHUB_USERNAME }}
STACKQL_GITHUB_PASSWORD: ${{ secrets.STACKQL_GITHUB_PASSWORD }}
google-example.iql
<<<jsonnet
local project = std.extVar("GOOGLE_PROJECT");
local zone = std.extVar("GOOGLE_ZONE");
{
project: project,
zone: zone,
}
>>>
SELECT status, count(*) as num_instances
FROM google.compute.instances
WHERE project = '{{ .project }}' and zone = '{{ .zone }}'
GROUP BY status;
Example
- name: exec google example with query file using vars
id: stackql-exec-file-with-vars
uses: ./
with:
query_file_path: './stackql_scripts/google-example.iql'
vars: GOOGLE_PROJECT=${{ env.GOOGLE_PROJECT }},GOOGLE_ZONE=${{ env.GOOGLE_ZONE }}
env:
GOOGLE_CREDENTIALS: ${{ secrets.GOOGLE_CREDENTIALS }}
GOOGLE_PROJECT: ${{ vars.GOOGLE_PROJECT }}
GOOGLE_ZONE: ${{ vars.GOOGLE_ZONE }}
query
- stackql query to execute (need to supply eitherquery
orquery_file_path
)query_file_path
- stackql query file to execute (need to supply eitherquery
orquery_file_path
)vars
- (optional) comma delimited list of variables to pass to the stackql query preprocessor (jsonnet), acceptsvar1=val1 var2=val2
, can be used to source environment variables into stackql queriesquery_output
- (optional) output format of the stackql exec result, acceptstable
,csv
,json
, defaults tojson
auth_obj_path
- (optional) the path of json file that stores stackql AUTH string (only required when using non-standard environment variable names)auth_str
- (optional) stackql AUTH string (only required when using non-standard environment variable names)
This action uses setup-stackql, with use_wrapper set
to true
, stdout
and stderr
are set to exec-result
and exec-error
exec-result
- The STDOUT stream of the call to thestackql
binary.exec-error
- The STDERR stream of the call to thestackql
binary.
To run unit tests locally against this action, use the following:
npm i
npm run test lib/tests/utils.test.js