Skip to content

Commit c873f70

Browse files
committed
Merge upstream main and exercise SNP backends in CI
2 parents 1dfbd29 + a55ec72 commit c873f70

117 files changed

Lines changed: 7440 additions & 2775 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.dockerignore‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
.github
22
.git
33
target
4-
**Dockerfile**
4+
**/node_modules
5+
frontend/dist
6+
**Dockerfile**

‎.github/workflows/actionlint.yml‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
name: Actionlint
22
on: [pull_request]
3+
permissions:
4+
contents: read
35
jobs:
46
actionlint:
57
name: Workflow Files
@@ -8,4 +10,8 @@ jobs:
810
- uses: actions/checkout@v5
911
- uses: reviewdog/action-actionlint@v1
1012
with:
11-
fail_on_error: true
13+
# Keep lint gating independent of check-run write permissions (forks
14+
# and read-only workflow tokens cannot publish reviewdog reports).
15+
reporter: local
16+
filter_mode: nofilter
17+
fail_level: error
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Trustee Frontend Check
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- 'frontend/**'
7+
- '.github/workflows/frontend-check.yml'
8+
push:
9+
branches: [main]
10+
paths:
11+
- 'frontend/**'
12+
- '.github/workflows/frontend-check.yml'
13+
14+
permissions:
15+
contents: read
16+
17+
jobs:
18+
frontend-check:
19+
name: Frontend build and audit
20+
runs-on: ubuntu-24.04
21+
defaults:
22+
run:
23+
working-directory: frontend
24+
steps:
25+
- uses: actions/checkout@v6
26+
- uses: actions/setup-node@v5
27+
with:
28+
node-version: '22'
29+
cache: npm
30+
cache-dependency-path: frontend/package-lock.json
31+
- run: npm ci
32+
- run: npm run build
33+
- run: npm audit

‎.github/workflows/gateway-check.yml‎

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,28 +6,39 @@ on:
66
- "main"
77
paths:
88
- 'trustee-gateway/**'
9+
- 'rvps/cgo/**'
10+
- 'kbs/kbs-init/**'
911
- '.github/workflows/gateway-check.yml'
1012
pull_request:
1113
paths:
1214
- 'trustee-gateway/**'
15+
- 'rvps/cgo/**'
16+
- 'kbs/kbs-init/**'
1317
- '.github/workflows/gateway-check.yml'
1418

1519
jobs:
1620
gateway-check:
17-
name: Go Test and Vet
21+
name: Go Test and Vet (${{ matrix.module }})
1822
runs-on: ubuntu-24.04
23+
strategy:
24+
fail-fast: false
25+
matrix:
26+
module: [trustee-gateway, rvps/cgo, kbs/kbs-init]
1927
defaults:
2028
run:
21-
working-directory: trustee-gateway
29+
working-directory: ${{ matrix.module }}
2230
steps:
2331
- name: Code checkout
2432
uses: actions/checkout@v5
2533
- name: Set up Go
26-
uses: actions/setup-go@v5
34+
uses: actions/setup-go@v6
2735
with:
28-
go-version-file: trustee-gateway/go.mod
29-
cache-dependency-path: trustee-gateway/go.sum
36+
go-version-file: ${{ matrix.module }}/go.mod
37+
cache-dependency-path: ${{ matrix.module }}/go.sum
3038
- name: Gateway test
3139
run: go test ./...
3240
- name: Gateway vet
3341
run: go vet ./...
42+
- name: Build RVPS shared library
43+
if: matrix.module == 'rvps/cgo'
44+
run: go build -buildmode=c-shared -o "${{ runner.temp }}/libcgo.so" .

‎.github/workflows/gateway-e2e.yml‎

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
name: Gateway API E2E
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- "trustee-gateway/**"
7+
- "kbs/**"
8+
- "attestation-service/**"
9+
- "rvps/**"
10+
- "deps/**"
11+
- "Cargo.toml"
12+
- "Cargo.lock"
13+
- ".github/workflows/gateway-e2e.yml"
14+
push:
15+
branches: [main]
16+
paths:
17+
- "trustee-gateway/**"
18+
- "kbs/**"
19+
- "attestation-service/**"
20+
- "rvps/**"
21+
- "deps/**"
22+
- "Cargo.toml"
23+
- "Cargo.lock"
24+
- ".github/workflows/gateway-e2e.yml"
25+
workflow_dispatch:
26+
27+
permissions:
28+
contents: read
29+
30+
jobs:
31+
gateway-api-e2e:
32+
name: Gateway API E2E (${{ matrix.engine }})
33+
runs-on: ubuntu-24.04
34+
timeout-minutes: 45
35+
strategy:
36+
fail-fast: false
37+
matrix:
38+
include:
39+
- engine: interpreter
40+
regovm: "0"
41+
- engine: regovm
42+
regovm: "1"
43+
env:
44+
RUSTUP_TOOLCHAIN: "1.88.0"
45+
CARGO_TERM_COLOR: always
46+
CARGO_PROFILE_DEV_DEBUG: "0"
47+
CARGO_PROFILE_DEV_OPT_LEVEL: "1"
48+
MYSQL_TEST_URL: mysql://root@127.0.0.1:3306/
49+
TRUSTEE_E2E_REGOVM: ${{ matrix.regovm }}
50+
TRUSTEE_E2E_ARTIFACT_DIR: ${{ github.workspace }}/e2e-artifacts
51+
services:
52+
mysql:
53+
image: mysql:8.0
54+
env:
55+
MYSQL_ALLOW_EMPTY_PASSWORD: "yes"
56+
ports:
57+
- 3306:3306
58+
options: >-
59+
--health-cmd "mysqladmin ping --silent"
60+
--health-interval 5s
61+
--health-timeout 5s
62+
--health-retries 20
63+
steps:
64+
- uses: actions/checkout@v5
65+
- name: Exercise restrictive MySQL defaults
66+
run: docker exec ${{ job.services.mysql.id }} mysql -uroot -e "SET GLOBAL innodb_default_row_format=COMPACT"
67+
- name: Install build dependencies
68+
run: sudo apt-get update && sudo apt-get install -y protobuf-compiler libssl-dev pkg-config
69+
- name: Install Rust
70+
run: rustup toolchain install "$RUSTUP_TOOLCHAIN" --profile minimal --no-self-update
71+
- uses: Swatinem/rust-cache@v2
72+
with:
73+
key: gateway-api-e2e-${{ matrix.engine }}
74+
- uses: actions/setup-go@v6
75+
with:
76+
go-version-file: trustee-gateway/go.mod
77+
cache-dependency-path: trustee-gateway/go.sum
78+
- name: Check route and documentation coverage guard
79+
working-directory: trustee-gateway
80+
run: go test ./cmd/server -run TestGatewayRoutesMatchDocumentedE2EContract -count=1
81+
- name: Run all Gateway APIs against real services
82+
run: bash trustee-gateway/test/e2e/run.sh
83+
- name: Upload API coverage (no keys, tokens, configurations or service logs)
84+
if: always()
85+
uses: actions/upload-artifact@v6
86+
with:
87+
name: gateway-api-coverage-${{ matrix.engine }}
88+
path: e2e-artifacts/api-coverage.json
89+
if-no-files-found: warn

‎.github/workflows/helm-check.yml‎

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: Helm Check
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- "helm-chart/trustee/**"
7+
- ".github/workflows/helm-check.yml"
8+
push:
9+
branches:
10+
- main
11+
paths:
12+
- "helm-chart/trustee/**"
13+
- ".github/workflows/helm-check.yml"
14+
15+
permissions:
16+
contents: read
17+
18+
jobs:
19+
helm-check:
20+
name: Helm Check
21+
runs-on: ubuntu-24.04
22+
steps:
23+
- name: Check out repository
24+
uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5
25+
26+
- name: Install Helm
27+
uses: azure/setup-helm@1a275c3b69536ee54be43f2070a358922e12c8d4 # v4.3.1
28+
with:
29+
version: v3.18.6
30+
31+
- name: Lint chart
32+
run: helm lint helm-chart/trustee
33+
34+
- name: Render legacy defaults
35+
run: helm template trustee helm-chart/trustee > /dev/null
36+
37+
- name: Render multi-replica shared storage
38+
shell: bash
39+
run: |
40+
set -euo pipefail
41+
rendered="${RUNNER_TEMP}/trustee-shared.yaml"
42+
helm template trustee helm-chart/trustee \
43+
--set sharedStorage.enabled=true \
44+
--set sharedStorage.existingSecret=trustee-storage \
45+
--set sharedStorage.asKeysExistingSecret=trustee-as-keys \
46+
--set kbs.tpmPca.existingSecret=trustee-tpm-pca \
47+
--set kbs.replicaCount=3 \
48+
--set as.replicaCount=3 \
49+
--set asrestful.replicaCount=3 \
50+
--set rvps.replicaCount=3 \
51+
--set gateway.replicaCount=3 > "${rendered}"
52+
53+
grep -q 'TRUSTEE_STORAGE_MYSQL_URL' "${rendered}"
54+
grep -q 'TRUSTEE_GATEWAY_DATABASE_DSN' "${rendered}"
55+
grep -q 'type = "SharedStore"' "${rendered}"
56+
grep -q '"type": "SharedStore"' "${rendered}"
57+
grep -q '/run/secrets/trustee/token-signer-key.pem' "${rendered}"
58+
59+
if grep -q 'volumeClaimTemplates:' "${rendered}"; then
60+
echo "shared storage render must not contain writable PVC templates" >&2
61+
exit 1
62+
fi
63+
if grep -q 'kbs-secret-watcher' "${rendered}"; then
64+
echo "LocalFs secret watcher must not run in shared storage mode" >&2
65+
exit 1
66+
fi
67+
68+
- name: Require Secret references in shared mode
69+
shell: bash
70+
run: |
71+
set -euo pipefail
72+
if helm template trustee helm-chart/trustee \
73+
--set sharedStorage.enabled=true > /dev/null 2>&1; then
74+
echo "shared storage rendered without required Secret references" >&2
75+
exit 1
76+
fi

‎.github/workflows/native-rpm.yml‎

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Native RPM Builds
2+
3+
on:
4+
push:
5+
paths:
6+
- 'rpm/**'
7+
- 'dist/**'
8+
- 'Cargo.*'
9+
- 'kbs/**'
10+
- 'attestation-service/**'
11+
- 'rvps/**'
12+
- 'deps/**'
13+
- 'trustee-gateway/**'
14+
- 'frontend/**'
15+
- '.github/workflows/native-rpm.yml'
16+
pull_request:
17+
paths:
18+
- 'rpm/**'
19+
- 'dist/**'
20+
- 'Cargo.*'
21+
- 'kbs/**'
22+
- 'attestation-service/**'
23+
- 'rvps/**'
24+
- 'deps/**'
25+
- 'trustee-gateway/**'
26+
- 'frontend/**'
27+
- '.github/workflows/native-rpm.yml'
28+
workflow_dispatch:
29+
30+
permissions:
31+
contents: read
32+
33+
jobs:
34+
build:
35+
name: ${{ matrix.distro }} / ${{ matrix.arch }}
36+
runs-on: ${{ matrix.runner }}
37+
timeout-minutes: 180
38+
strategy:
39+
fail-fast: false
40+
matrix:
41+
distro: [al8, an23]
42+
arch: [x86_64, aarch64]
43+
include:
44+
- arch: x86_64
45+
runner: ubuntu-24.04
46+
- arch: aarch64
47+
runner: ubuntu-24.04-arm
48+
steps:
49+
- uses: actions/checkout@v6
50+
- name: Build and smoke-test native RPMs
51+
run: sudo bash rpm/build-rpm.sh "${{ matrix.distro }}"
52+
- uses: actions/upload-artifact@v6
53+
with:
54+
name: rpm-${{ matrix.distro }}-${{ matrix.arch }}
55+
if-no-files-found: error
56+
path: |
57+
rpm-output/${{ matrix.distro }}/${{ matrix.arch }}/RPMS/**/*.rpm
58+
rpm-output/${{ matrix.distro }}/${{ matrix.arch }}/SRPMS/*.rpm

‎.github/workflows/release-rpm.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ jobs:
2828
- name: Set up Go
2929
uses: actions/setup-go@v6
3030
with:
31-
go-version: '1.21'
31+
go-version-file: trustee-gateway/go.mod
3232

3333
- name: Set up Node.js
3434
uses: actions/setup-node@v5
3535
with:
36-
node-version: '18'
36+
node-version: '22'
3737

3838
- name: Install build dependencies
3939
run: |

‎.github/workflows/rust-check.yml‎

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,9 @@ jobs:
9595
working-directory: kbs
9696
run: make check
9797

98+
- name: KBS PKCS11 Check
99+
run: cargo check -p kbs --no-default-features --features pkcs11
100+
98101
- name: KBS EncryptedDb Test
99102
working-directory: kbs
100103
env:
@@ -104,6 +107,16 @@ jobs:
104107
mysql -uroot -e "SET GLOBAL innodb_default_row_format=COMPACT"
105108
make check TEST_FEATURES=encrypted-db
106109
110+
- name: Shared Storage Test
111+
env:
112+
MYSQL_TEST_URL: mysql://root@127.0.0.1:3306/trustee_kbs_test
113+
run: |
114+
cargo test -p key-value-storage
115+
cargo test -p kbs shared_storage_mysql
116+
cargo test -p attestation-service shared_storage_mysql
117+
cargo test -p reference-value-provider-service shared_storage_mysql
118+
cargo test -p rvds shared_storage_mysql
119+
107120
as-check:
108121
if: |
109122
github.event_name == 'pull_request' ||
@@ -162,6 +175,12 @@ jobs:
162175
rustup component add --toolchain ${{ env.RUSTC_VERSION }} rustfmt rustc clippy
163176
rustup default ${{ env.RUSTC_VERSION }}
164177
178+
# Run before sudo-based tests create root-owned Cargo build/cache files.
179+
- name: Run pure-Rust SNP verifier tests and lint
180+
run: |
181+
cargo test -p verifier --no-default-features --features snp-rustcrypto snp:: --lib
182+
cargo clippy -p verifier --no-default-features --features snp-rustcrypto --all-targets -- -D warnings -A clippy::derive_partial_eq_without_eq
183+
165184
- name: AS Build
166185
working-directory: attestation-service
167186
run: |
@@ -254,5 +273,5 @@ jobs:
254273
run: |
255274
RUSTUP_TOOLCHAIN=nightly-2025-07-07 cargo check -p eventlog --target wasm32-unknown-unknown
256275
RUSTUP_TOOLCHAIN=nightly-2025-07-07 cargo check -p reference-value-provider-service --target wasm32-unknown-unknown --no-default-features # no "fs" feature in wasm
257-
RUSTUP_TOOLCHAIN=nightly-2025-07-07 cargo check -p attestation-service --target wasm32-unknown-unknown --no-default-features --features tdx-dcap-rust,policy-artifact-server,policy-rvps,regorus-regovm
258-
RUSTUP_TOOLCHAIN=nightly-2025-07-07 cargo check -p verifier --target wasm32-unknown-unknown --no-default-features --features tdx-dcap-rust
276+
RUSTUP_TOOLCHAIN=nightly-2025-07-07 cargo check -p attestation-service --target wasm32-unknown-unknown --no-default-features --features tdx-dcap-rust,snp-rustcrypto,policy-artifact-server,policy-rvps,regorus-regovm
277+
RUSTUP_TOOLCHAIN=nightly-2025-07-07 cargo check -p verifier --target wasm32-unknown-unknown --no-default-features --features tdx-dcap-rust,snp-rustcrypto

‎.gitignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
target
22
.vscode
3+
/rpm-output/

0 commit comments

Comments
 (0)