Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add end-to-end test with docker compose and sample attester #283

Merged
merged 9 commits into from
Jan 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
61 changes: 61 additions & 0 deletions .github/workflows/kbs-docker-e2e.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: KBS End-to-End test with Docker Compose and Sample Attester

on:
pull_request:
branches:
- main

env:
TEST_SECRET_CONTENT: shhhhh
TEST_SECRET_PATH: test-org/test-repo/test-secret

jobs:
e2e-test:
runs-on: ubuntu-latest
steps:
- name: Checkout KBS
uses: actions/checkout@v4

- name: Install Rust (for client)
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable

- name: Build client
uses: actions-rs/cargo@v1
with:
command: build
args: --manifest-path kbs/tools/client/Cargo.toml --no-default-features --features sample_only --release

- name: Setup Keys
run: |
openssl genpkey -algorithm ed25519 > kbs/config/private.key
openssl pkey -in kbs/config/private.key -pubout -out kbs/config/public.pub

- name: Build KBS Cluster
run: docker compose build

- name: Start KBS cluster
run: docker compose up -d

- name: Set Resource
working-directory: target/release/
run: |
echo "$TEST_SECRET_CONTENT" > test-secret
./kbs-client --url http://127.0.0.1:8080 config --auth-private-key ../../kbs/config/private.key set-resource --path "$TEST_SECRET_PATH" --resource-file test-secret

- name: Get Resource (negative)
working-directory: target/release/
run: |
! ./kbs-client --url http://127.0.0.1:8080 get-resource --path "$TEST_SECRET_PATH"

- name: Update policy
working-directory: target/release/
run: ./kbs-client --url http://127.0.0.1:8080 config --auth-private-key ../../kbs/config/private.key set-resource-policy --policy-file "$policy_path"
env:
policy_path: ../../kbs/test/data/policy_2.rego

- name: Get Resource
working-directory: target/release/
run: ./kbs-client --url http://127.0.0.1:8080 get-resource --path "$TEST_SECRET_PATH"
Loading
Loading