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

example-setup: update manifest generation script #197

Merged
merged 1 commit into from
Aug 7, 2024
Merged
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
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
Loading