Skip to content

Commit 56ba9d5

Browse files
application-data-and-sundries
Summary: - Remove obsolete colour rendering hack to "square up" colouring by adding leading line break to `stdin`. - Shell welcome message migrated to `stderr`. - Docker CI file permissions repair. - Amended expectation for robot test `Shell Session Simple`. - Amended expectation for robot test `Shell Session Azure Compute Table Nomenclature Mutation Guard`. - Added robot test `Alternate App Root Persists All Temp Materials in Alotted Directory`.
1 parent 4eee90e commit 56ba9d5

File tree

20 files changed

+519
-18
lines changed

20 files changed

+519
-18
lines changed

.github/workflows/build.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ env:
2828
GH_ACCESS_TOKEN: ${{ secrets.ACTIONS_PRIVATE_PACKAGE_SECRET }}
2929
PLANCACHEENABLED: "true"
3030
CI_IS_EXPRESS: ${{ github.ref_type == 'tag' && contains(github.ref_name, 'express') && 'true' || 'false' }}
31+
STACKQL_IMAGE_NAME: ${{ vars.STACKQL_IMAGE_NAME != '' && vars.STACKQL_IMAGE_NAME || (github.repository == 'stackql/stackql' || github.repository == 'stackql/stackql-devel') && github.repository || 'stackql/stackql' }}
3132

3233
jobs:
3334

@@ -1137,6 +1138,8 @@ jobs:
11371138
echo "BUILDMAJORVERSION=$BUILDMAJORVERSION"
11381139
echo "BUILDMINORVERSION=$BUILDMINORVERSION"
11391140
echo "BUILDPATCHVERSION=$BUILDPATCHVERSION"
1141+
echo "UID=${UID}"
1142+
echo "GID=${GID}"
11401143
} >> "${GITHUB_ENV}"
11411144
11421145
- name: Generate rewritten registry for simulations
@@ -1168,7 +1171,6 @@ jobs:
11681171
11691172
- name: Build Stackql image with buildx
11701173
uses: docker/build-push-action@v5
1171-
if: ${{ (github.repository == 'stackql/stackql' || github.repository == 'stackql/stackql-devel') }}
11721174
with:
11731175
context: .
11741176
build-args: |
@@ -1179,13 +1181,15 @@ jobs:
11791181
target: app
11801182
no-cache: ${{ vars.CI_DOCKER_BUILD_NO_CACHE == 'true' && true || false }}
11811183
load: true
1182-
tags: ${{ github.repository }}:${{github.sha}},${{ github.repository }}:v${{env.BUILDMAJORVERSION}}.${{env.BUILDMINORVERSION}}.${{env.BUILDPATCHVERSION}},${{ github.repository }}:latest
1184+
tags: ${{ env.STACKQL_IMAGE_NAME }}:${{github.sha}},${{ env.STACKQL_IMAGE_NAME }}:v${{env.BUILDMAJORVERSION}}.${{env.BUILDMINORVERSION}}.${{env.BUILDPATCHVERSION}},${{ env.STACKQL_IMAGE_NAME }}:latest
11831185

11841186
- name: Debug info
11851187
run: |
11861188
echo "psql version info: $(psql --version)"
11871189
echo ""
1188-
echo "docker-compose version info: $(docker-compose -version)"
1190+
echo "docker-compose version info: $(docker compose -version)"
1191+
echo ""
1192+
echo "docker images: $(docker images)"
11891193
echo ""
11901194
echo "robot version info: $(robot --version)"
11911195
echo ""
@@ -1283,5 +1287,5 @@ jobs:
12831287
RUN_INTEGRATION_TESTS=0
12841288
push: true
12851289
target: app
1286-
tags: ${{ github.repository }}:${{github.sha}},${{ github.repository }}:v${{env.BUILDMAJORVERSION}}.${{env.BUILDMINORVERSION}}.${{env.BUILDPATCHVERSION}},${{ github.repository }}:latest
1290+
tags: ${{ env.STACKQL_IMAGE_NAME }}:${{github.sha}},${{ env.STACKQL_IMAGE_NAME }}:v${{env.BUILDMAJORVERSION}}.${{env.BUILDMINORVERSION}}.${{env.BUILDPATCHVERSION}},${{ env.STACKQL_IMAGE_NAME }}:latest
12871291

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,5 @@ y.output
3030
*.pyc
3131

3232
.stackql/
33+
34+
.venv/

.vscode/launch.json

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,8 @@
153153
"set global \"a.b\"=1;",
154154
"set global \"$.auth.google.sub\"='[email protected]';",
155155
"select JSON_EXTRACT(saml.samlIdentity, '$.username') as saml_username from github.scim.saml_ids saml where saml.org = 'dummyorg';",
156-
"select kind, name, maximumCardsPerInstance from google.compute.acceleratorTypes where project = 'defective-response-content-project' and zone = 'australia-southeast1-a' order by name desc;"
156+
"select kind, name, maximumCardsPerInstance from google.compute.acceleratorTypes where project = 'defective-response-content-project' and zone = 'australia-southeast1-a' order by name desc;",
157+
"registry pull google;"
157158
],
158159
"default": "show providers;"
159160
},
@@ -197,6 +198,16 @@
197198
"-tags=sqlite_stackql"
198199
]
199200
},
201+
{
202+
"type": "pickString",
203+
"id": "appRoot",
204+
"description": "Extra Build Flags for debug; cannot place elsewhere",
205+
"default": "${workspaceFolder}",
206+
"options": [
207+
"${workspaceFolder}",
208+
"${workspaceFolder}/test/tmp/.vscode.debug.stackql",
209+
]
210+
},
200211
{
201212
"type": "pickString",
202213
"id": "concurrencyLimit",
@@ -393,6 +404,7 @@
393404
"--dataflow.dependency.max=${input:dataflowDependencyMax}",
394405
"--dataflow.components.max=${input:dataflowComponentsMax}",
395406
"--http.log.enabled=${input:httpLogEnabled}",
407+
"--approot=${input:appRoot}",
396408
"${input:queryString}"
397409
],
398410
},

cicd/env/.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
pyenv/
2-
*.sh
1+
*
2+
!.gitignore

cicd/keys/.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
*
22
!.gitignore
33
!integration/
4-
!work/
4+
!work/
5+
!testing/

cicd/keys/testing/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*
2+
!.gitignore

cicd/requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@ PyYaml>=6.0.1
55
requests==2.32.3
66
robotframework==6.1.1
77
sqlalchemy==1.4.44
8+
9+
mistune==3.0.2

docker-compose-persist-postgres.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@ version: "3.9"
22

33
services:
44
stackqlsrv:
5-
image: stackql/stackql
5+
image: "${STACKQL_IMAGE_NAME:-stackql/stackql}"
66
build:
7+
user: "${UID}:${GID}"
78
context: .
89
cache_from:
9-
- stackql/stackql
10+
- "${STACKQL_IMAGE_NAME:-stackql/stackql}"
1011
- stackql/integration
1112
- stackql/stackqlsrvcertificates
1213
args:
@@ -43,6 +44,7 @@ services:
4344
- ./cicd/vol/srv/credentials:/opt/stackql/srv/credentials:ro
4445
- ./test/assets/credentials/dummy:/opt/stackql/credentials/dummy:ro
4546
- ./test/assets/input:/opt/stackql/input:ro
47+
- ./test/tmp:/opt/test/tmp:rw
4648
- ${DB_SETUP_SRC:-./test/db/sqlite}:/opt/stackql/db:ro
4749
- ${REGISTRY_SRC:-./test/registry-mocked}:/opt/stackql/registry:ro
4850
- ./cicd/vol/stackql/config:/opt/stackql/.stackql:rw

docker-compose.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@ version: "3.9"
22

33
services:
44
stackqlsrv:
5-
image: stackql/stackql
5+
user: "${UID}:${GID}"
6+
image: "${STACKQL_IMAGE_NAME:-stackql/stackql}"
67
build:
78
context: .
89
cache_from:
9-
- stackql/stackql
10+
- "${STACKQL_IMAGE_NAME:-stackql/stackql}"
1011
- stackql/integration
1112
- stackql/stackqlsrvcertificates
1213
args:
@@ -43,6 +44,7 @@ services:
4344
- ./cicd/vol/srv/credentials:/opt/stackql/srv/credentials:ro
4445
- ./test/assets/credentials/dummy:/opt/stackql/credentials/dummy:ro
4546
- ./test/assets/input:/opt/stackql/input:ro
47+
- ./test/tmp:/opt/test/tmp:rw
4648
- ${DB_SETUP_SRC:-./test/db/sqlite}:/opt/stackql/db:ro
4749
- ${REGISTRY_SRC:-./test/registry-mocked}:/opt/stackql/registry:ro
4850
- ./cicd/vol/stackql/config:/opt/stackql/.stackql:rw
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
2+
## Setup
3+
4+
First, create a google service account key using the GCP Console, per [the GCP documentation](https://cloud.google.com/iam/docs/keys-create-delete). Grant the service account at least `Viewer` role equivalent privileges, per [the GCP dumentation](https://cloud.google.com/iam/docs/create-service-agents#grant-roles).
5+
6+
Then, do this in bash:
7+
8+
```bash setup stackql-shell credentials-path=cicd/keys/testing/google-credentials.json app-root-path=./test/tmp/.get-google-vms.stackql
9+
10+
export GOOGLE_CREDENTIALS="$(cat <credentials-path>)";
11+
12+
stackql shell --approot=<app-root-path>
13+
```
14+
15+
## Method
16+
17+
Do this in the `stackql` shell, replacing `<project>` with your GCP project name:
18+
19+
```sql stackql-shell input required project=ryuki-it-sandbox-01 region=australia-southeast1-a
20+
21+
registry pull google;
22+
23+
select
24+
name,
25+
id
26+
FROM google.compute.instances
27+
WHERE
28+
project = '<project>'
29+
AND zone = '<region>'
30+
;
31+
32+
```
33+
34+
## Result
35+
36+
37+
You will see something very much like this included in the output, presuming you have one VM (if you have zero, only the headers should appper, more VMs means more rows):
38+
39+
```sql stackql stdout expectation stdout-table-contains-data
40+
|--------------------------------------------------|---------------------|
41+
| name | id |
42+
|--------------------------------------------------|---------------------|
43+
| any-compute-cluster-1-default-abcd-00000001-0001 | 1000000000000000001 |
44+
|--------------------------------------------------|---------------------|
45+
```
46+
47+
<!--- EXPECTATION
48+
google\ provider,\ version\ 'v24.11.00274'\ successfully\ installed
49+
goodbye
50+
-->
51+
52+
<x-expectation style="display: none;">
53+
<stdout-contains-nonempty-table></stdout-contains-nonempty-table>
54+
</x-expectation>
55+
56+
## Cleanup
57+
58+
```bash teardown best-effort app-root-path=./test/tmp/.get-google-vms.stackql
59+
60+
rm -rf <app-root-path>
61+
62+
```

0 commit comments

Comments
 (0)