Skip to content

Commit be8863c

Browse files
Merge pull request #5 from stackql/feature/file-auth
Feature/file auth
2 parents 5b21e64 + 5ebeed9 commit be8863c

File tree

5 files changed

+67
-42
lines changed

5 files changed

+67
-42
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: 'Setup StackQL'
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- 'develop-**'
8+
pull_request:
9+
10+
defaults:
11+
run:
12+
shell: bash
13+
14+
jobs:
15+
stackql-versions:
16+
name: 'Stackql Versions'
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v3
22+
23+
- name: Setup stackql
24+
uses: ./
25+
26+
27+
- name: Validate Stackql Version
28+
run: |
29+
stackql --version
30+
31+
- name: Use GitHub Provider
32+
run: |
33+
stackql exec -i ./examples/github-example.iql --auth="${AUTH}"
34+
env:
35+
AUTH: ${{ vars.AUTH }} ##'{ "github": { "type": "basic", "credentialsenvvar": "STACKQL_GITHUB_CREDS" } }'
36+
STACKQL_GITHUB_CREDS: ${{ secrets.STACKQL_GITHUB_CREDS }}
37+
38+
- name: use Google Provider
39+
run: | ## use the secret to create json file
40+
sudo echo ${{ secrets.GOOGLE_CREDS }} | base64 -d > sa-key.json
41+
stackql exec -i ./examples/google-example.iql --auth="${AUTH}"
42+
env:
43+
AUTH: ${{ vars.AUTH }} ## '{ "google": { "type": "service_account", "credentialsfilepath": "sa-key.json" }}'

.github/workflows/set-up-stackql.yml

Lines changed: 0 additions & 36 deletions
This file was deleted.

README.md

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,26 @@ The `stackql/setup-stackql` action is a JavaScript action that sets up Terraform
55
- Downloading a latest Stackql CLI and adding it to the `PATH`.
66
- Setup AUTH env var in the Github Action
77

8-
## Auth object string
9-
Example
8+
# Auth
9+
[Learn more](https://stackql.io/docs/getting-started/authenticating) about authentication setup when running stackql
10+
11+
### Basic Example
12+
1. Set Auth variable, for example:
13+
```
14+
{ "github": { "type": "basic", "credentialsenvvar": "STACKQL_GITHUB_CREDS" } }
15+
```
16+
2. create the github token as a secret
17+
3. In the execution step, pass the secret as environment variable with name "STACKQL_GITHUB_CREDS"
18+
19+
Check the "Use GitHub Provider" step in `.github/workflows/example-workflows.yml` for the working example
20+
21+
### json File Auth example
22+
23+
1. Set Auth variable, for example:
1024
```
11-
{
12-
"google": { "credentialsfilepath": "creds/stackql-demo.json", "type": "service_account" },
13-
"okta": { "credentialsenvvar": "OKTA_SECRET_KEY", "type": "api_key", credentials: '<your credentials>' }
14-
}
25+
{ "google": { "type": "service_account", "credentialsfilepath": "sa-key.json" }}
1526
```
27+
2. encode the key json file into base64 string
28+
3. in execution step, run `sudo echo ${{ secrets.<name of the secret> }} | base64 -d > sa-key.json`
1629

30+
Check the "Use Google Provider" step in `.github/workflows/example-workflows.yml` for the working example
File renamed without changes.

examples/google-example.iql

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
REGISTRY PULL google v23.01.00116;
2+
SELECT name, status
3+
FROM google.compute.instances
4+
WHERE project = 'stackql-demo' AND zone = 'australia-southeast1-a';

0 commit comments

Comments
 (0)