Skip to content

Commit cfd6ded

Browse files
committed
e2e-test: populate ref-values with podvm measurements
We retrieve the podvm measurements from the earlier podvm build step after verifying the provenance and convert it to a reference-values.json file that will be used when KBS is deployed in the e2e test. Signed-off-by: Magnus Kulke <magnuskulke@microsoft.com>
1 parent 70b6308 commit cfd6ded

1 file changed

Lines changed: 34 additions & 1 deletion

File tree

.github/workflows/azure-e2e-test.yml

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,9 +244,42 @@ jobs:
244244
AZURE_SUBNET_ID="$subnet_id"
245245
EOF
246246
247-
- name: Checkout KBS Repository
247+
- name: Configure KBS
248248
run: test/utils/checkout_kbs.sh
249249

250+
- name: Populate RVPS reference-values.json
251+
env:
252+
OCI_NAME: "ghcr.io/${{ github.repository }}/measurements/azure/podvm"
253+
AZURE_IMAGE_ID: "${{ inputs.podvm-image-id }}"
254+
TEE_KEY: "az${{ matrix.parameters.id }}vtpm"
255+
GH_REPO: "${{ github.repository }}"
256+
GIT_SHA: "${{ github.sha }}"
257+
GH_TOKEN: "${{ github.token }}"
258+
run: |
259+
# resolve the measurement tag to digest, assert proper provenance, pull measurements.json
260+
image_version="$(basename "$AZURE_IMAGE_ID")"
261+
oci_digest="$(oras resolve "${OCI_NAME}:${image_version}")"
262+
oci_registry="${OCI_NAME}@${oci_digest}"
263+
gh attestation verify -R "$GH_REPO" "oci://${oci_registry}" --source-digest "$GIT_SHA"
264+
oras pull "$oci_registry"
265+
266+
# convert measurements.json to reference-values.json
267+
expiry="$(date -u -d '+1 year' '+%Y-%m-%dT%H:%M:%SZ')"
268+
jq --arg tee_key "$TEE_KEY" --arg expiry "$expiry" '
269+
.measurements.sha256
270+
| to_entries
271+
| map({
272+
name: ($tee_key + ".tpm." + .key),
273+
expired: $expiry,
274+
"hash-value": [
275+
{
276+
alg: "sha256",
277+
value: (.value | ltrimstr("0x") | ascii_downcase)
278+
}
279+
]
280+
})
281+
' measurements.json > ./test/trustee/kbs/config/kubernetes/base/reference-values.json
282+
250283
- name: Run e2e test
251284
env:
252285
TEST_PROVISION: "no"

0 commit comments

Comments
 (0)