mirror of
https://github.com/edgelesssys/constellation.git
synced 2024-10-01 01:36:09 -04:00
update shellscript for in-place updates
This commit is contained in:
parent
c9b684e5cb
commit
87d39b06f7
@ -4,6 +4,16 @@
|
||||
|
||||
###### script header ######
|
||||
|
||||
update=false
|
||||
if [[ $# -gt 0 ]]; then
|
||||
if [[ $1 == "update" ]]; then
|
||||
update=true
|
||||
else
|
||||
echo "Error: unknown argument $1"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
lib=$(realpath @@BASE_LIB@@) || exit 1
|
||||
stat "${lib}" >> /dev/null || exit 1
|
||||
|
||||
@ -13,6 +23,12 @@ if ! source "${lib}"; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
bucket=cdn-constellation-backend
|
||||
|
||||
# tepmorary directory for storing computed hashes
|
||||
dir=$(mktemp -d -t constellation-XXXXXXXXXX)
|
||||
trap 'rm -rf "${dir}"' EXIT
|
||||
|
||||
declare -A pseudo_version_tools
|
||||
pseudo_version_tools["darwin_amd64"]="$(realpath @@PSEUDO_VERSION_darwin_amd64@@)"
|
||||
pseudo_version_tools["darwin_arm64"]="$(realpath @@PSEUDO_VERSION_darwin_arm64@@)"
|
||||
@ -35,9 +51,17 @@ for platform in "${platforms[@]}"; do
|
||||
# compare hash to saved hash in ${BUILD_WORKSPACE_DIRECTORY}/tools/pseudo_version_${platform}.sha256
|
||||
saved_hash=$(cat "${BUILD_WORKSPACE_DIRECTORY}/tools/pseudo_version_${platform}.sha256")
|
||||
if [[ ${computed_hash} != "${saved_hash}" ]]; then
|
||||
echo "Error: pseudo-version tool hash for ${platform} does not match saved hash"
|
||||
echo "Pseudo-version tool hash for ${platform} does not match saved hash"
|
||||
echo "Computed hash: ${computed_hash}"
|
||||
echo "Saved hash: ${saved_hash}"
|
||||
if [[ ${update} == true ]]; then
|
||||
echo "Uploading computed hash to S3"
|
||||
aws s3 cp "${pseudo_version_tools[$platform]}" "s3://${bucket}/constellation/cas/sha256/${computed_hash}"
|
||||
echo "Updating saved hash"
|
||||
echo "${computed_hash}" > "${BUILD_WORKSPACE_DIRECTORY}/tools/pseudo_version_${platform}.sha256"
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
done
|
||||
echo "Pseudo-version tool hashes are up to date"
|
||||
|
Loading…
Reference in New Issue
Block a user