Skip to content

Commit

Permalink
example-setup: update manifest generation script
Browse files Browse the repository at this point in the history
Signed-off-by: Simon Ott <[email protected]>
  • Loading branch information
smo4201 committed Aug 7, 2024
1 parent abdada1 commit fa967bd
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions example-setup/update-container-manifest-live
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ input="${data}/metadata-raw"
tmp="${data}/metadata-tmp"
output="${data}/metadata-signed"
runtime="${cmc}/tools/containerd-shim-cmc-v1/containerd-shim-cmc-v1"
runc_config="/etc/runc.json"
target="${target%/}"


Expand All @@ -57,6 +58,18 @@ echo "Using ${data} as directory for local data"
# Delete temporary manifests
rm -rf "${tmp}"/*

# Temporarily configure runc to generate reference values
if [ ! -f "${runc_config}" ]; then
exists=false
sudo printf "{\"generateRefVals\":\"true\"}" > "${runc_config}"
else
exists=true
json=$(cat "${runc_config}")
original_json=${json}
json=$(echo "$json" | jq '.generateRefVals = true')
echo "${json}" | sudo tee "${runc_config}"
fi

# Calculate the container reference values
sudo rm -f /tmp/container-refs

Expand Down Expand Up @@ -99,6 +112,17 @@ else
exit
fi

# Restore the original runc config
if [ "${exists}" = true ] ; then
echo "WRITING BACK ${original_json}"
echo "${original_json}" | sudo tee "${runc_config}"
else
sudo rm "${runc_config}"
fi

echo "RESTORED"
jq . "${runc_config}"

refvals=$(cat /tmp/container-refs)

# if containers not set, set it to the single container
Expand Down

0 comments on commit fa967bd

Please sign in to comment.