Skip to content

Commit 448c422

Browse files
authored
feat(ci): reusable platform startup for client CI tests (#1531)
Resolves #1530 Adds reusable `start-up-with-containers` composite action and `start-additional-kas` action for multi-kas test scenarios. This ensures the platform CI and all consumers CIs are driven close to platform code with consumers having to know very little about the internals of booting up the platform. Evidence of working functionality in otdfctl e2e test flow: https://github.com/opentdf/otdfctl/actions/runs/10745375375/job/29804266845?pr=369 Evidence of working functionality in xtest test flows: opentdf/tests#190
1 parent ae8d8a2 commit 448c422

File tree

2 files changed

+100
-0
lines changed

2 files changed

+100
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: 'start-additional-kas'
2+
3+
# This action relies on the start-up-with-containers action having already run.
4+
# Things like the working directory and configuration location are controlled by that action as predecessor.
5+
6+
description: 'After start-up-with-containers has run, run an additional KAS instance'
7+
8+
inputs:
9+
kas-port:
10+
required: true
11+
description: 'The port for the additional KAS'
12+
kas-name:
13+
required: true
14+
description: 'The name for the additional KAS'
15+
16+
runs:
17+
using: 'composite'
18+
steps:
19+
- uses: JarvusInnovations/background-action@2428e7b970a846423095c79d43f759abf979a635
20+
name: Start another KAS server in background
21+
with:
22+
run: >
23+
<opentdf.yaml >opentdf-${{ inputs.kas-name }}.yaml yq e '
24+
(.server.port = ${{ inputs.kas-port }})
25+
| (.mode = ["kas"])
26+
| (.sdk_config = {"endpoint":"http://localhost:8080","plaintext":true,"client_id":"opentdf","client_secret":"secret"})
27+
'
28+
&& .github/scripts/watch.sh opentdf-${{ inputs.kas-name }}.yaml ./opentdf --config-file ./opentdf-${{ inputs.kas-name }}.yaml start
29+
wait-on: |
30+
tcp:localhost:${{ inputs.kas-port }}
31+
log-output-if: true
32+
wait-for: 90s
33+
working-directory: otdf-test-platform
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: 'start-up-with-containers'
2+
3+
description: 'Start the OpenTDF Platform with its containerized resources'
4+
5+
inputs:
6+
platform-ref:
7+
required: false
8+
description: 'The ref to check out for the platform'
9+
default: 'main'
10+
11+
runs:
12+
using: 'composite'
13+
steps:
14+
- name: Check out platform
15+
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
16+
with:
17+
repository: opentdf/platform
18+
# use a distinct path to avoid conflicts
19+
path: otdf-test-platform
20+
ref: ${{ inputs.platform-ref }}
21+
- name: Set up go (platform's go version)
22+
id: setup-go
23+
uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7
24+
with:
25+
go-version-file: 'otdf-test-platform/service/go.mod'
26+
check-latest: false
27+
cache-dependency-path: |
28+
otdf-test-platform/service/go.sum
29+
otdf-test-platform/protocol/go/go.sum
30+
otdf-test-platform/sdk/go.sum
31+
- name: Provide the platform with keys
32+
shell: bash
33+
run: |
34+
.github/scripts/init-temp-keys.sh
35+
cp opentdf-dev.yaml opentdf.yaml
36+
working-directory: otdf-test-platform
37+
- name: Trust the generated certs
38+
shell: bash
39+
run: |
40+
sudo chmod -R 777 ./keys
41+
sudo apt-get install -y ca-certificates
42+
sudo cp ./keys/localhost.crt /usr/local/share/ca-certificates
43+
sudo update-ca-certificates
44+
working-directory: otdf-test-platform
45+
- name: Spin up platform's containerized resources
46+
shell: bash
47+
run: docker compose up -d --wait --wait-timeout 240
48+
working-directory: otdf-test-platform
49+
- name: Provision realms/clients/users into idP
50+
shell: bash
51+
run: go run ./service provision keycloak
52+
working-directory: otdf-test-platform
53+
- name: Provision test fixture policy
54+
shell: bash
55+
run: go run ./service provision fixtures
56+
working-directory: otdf-test-platform
57+
- name: Start platform server in background
58+
uses: JarvusInnovations/background-action@2428e7b970a846423095c79d43f759abf979a635
59+
with:
60+
run: >
61+
go build -o opentdf -v service/main.go
62+
&& .github/scripts/watch.sh opentdf.yaml ./opentdf start
63+
wait-on: |
64+
tcp:localhost:8080
65+
log-output-if: true
66+
wait-for: 90s
67+
working-directory: otdf-test-platform

0 commit comments

Comments
 (0)