2023-01-09 02:54:41 -05:00
|
|
|
name: Constellation verify
|
|
|
|
description: "Verify a Constellation cluster."
|
|
|
|
|
|
|
|
inputs:
|
|
|
|
osImage:
|
|
|
|
description: "The OS image used in the cluster."
|
|
|
|
required: true
|
|
|
|
cloudProvider:
|
|
|
|
description: "The cloud provider used in the cluster."
|
|
|
|
required: true
|
|
|
|
|
|
|
|
runs:
|
|
|
|
using: "composite"
|
|
|
|
steps:
|
|
|
|
- name: Clear current measurements
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
yq -i 'del(.provider.${{ inputs.cloudProvider }}.measurements)' constellation-conf.yaml
|
2023-01-18 04:15:58 -05:00
|
|
|
|
2023-03-21 12:35:07 -04:00
|
|
|
- name: Expand version path
|
|
|
|
id: expand-version
|
|
|
|
uses: ./.github/actions/shortname
|
|
|
|
with:
|
|
|
|
shortname: ${{ inputs.osImage }}
|
|
|
|
|
2023-01-09 02:54:41 -05:00
|
|
|
- name: Fetch & write measurements
|
|
|
|
shell: bash
|
|
|
|
run: |
|
2023-03-21 12:35:07 -04:00
|
|
|
ref=${{ steps.expand-version.outputs.ref }}
|
|
|
|
stream=${{ steps.expand-version.outputs.stream }}
|
|
|
|
version=${{ steps.expand-version.outputs.version }}
|
|
|
|
verPath="ref/${ref}/stream/${stream}/${version}"
|
|
|
|
MEASUREMENTS=$(curl -fsSL https://cdn.confidential.cloud/constellation/v1/${verPath}/image/csp/${{ inputs.cloudProvider }}/measurements.json | jq '.measurements' -r)
|
2023-01-09 02:54:41 -05:00
|
|
|
for key in $(echo $MEASUREMENTS | jq 'keys[]' -r); do
|
|
|
|
echo Updating $key to $(echo $MEASUREMENTS | jq ".\"$key\"" -r)
|
2023-01-19 04:14:10 -05:00
|
|
|
yq -i ".provider.${{ inputs.cloudProvider }}.measurements.[$key] = $(echo $MEASUREMENTS | jq ".\"$key\"")" constellation-conf.yaml
|
2023-01-09 02:54:41 -05:00
|
|
|
done
|
|
|
|
yq -i '.provider.${{ inputs.cloudProvider }}.measurements |= array_to_map' constellation-conf.yaml
|
|
|
|
cat constellation-conf.yaml
|
2023-01-18 04:15:58 -05:00
|
|
|
|
2023-01-09 02:54:41 -05:00
|
|
|
- name: Constellation verify
|
|
|
|
shell: bash
|
2023-02-14 03:15:01 -05:00
|
|
|
run: constellation verify --cluster-id $(jq -r ".clusterID" constellation-id.json) --force
|