Skip to content
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
26 changes: 18 additions & 8 deletions scripts/eessi-upload-to-staging
Original file line number Diff line number Diff line change
Expand Up @@ -222,17 +222,17 @@ set -- "${POSITIONAL_ARGS[@]}"

# ensure that either none or both of $sign_key and $sign_script are defined
if [[ -n "${sign_key}" ]] && [[ -n "${sign_script}" ]]; then
sign=1
sign=yes
elif [[ -n "${sign_key}" ]]; then
sign=0
sign=no
echo "Error: Signing requires a key (${sign_key}) AND a script (${sign_script}); likely the bot config is incomplete" >&2
exit 1
elif [[ -n "${sign_script}" ]]; then
sign=0
sign=no
echo "Error: Signing requires a key (${sign_key}) AND a script (${sign_script}); likely the bot config is incomplete" >&2
exit 1
else
sign=0
sign=no
fi

# infer bucket_base:
Expand Down Expand Up @@ -268,11 +268,16 @@ for file in "$*"; do
fi
aws_file=$(basename ${file})
# 1st sign artefact, and upload signature
if [[ "${sign}" = "1" ]]; then
if [[ "${sign}" = "yes" ]]; then
sig_file=${file}.sig
# delete sig file if it already exists
if [[ -f "${sig_file}" ]]; then
rm -f ${sig_file}
echo "INFO: removed existing signature file (${sig_file})"
fi
# sign artefact
${sign_script} --sign --private-key ${sign_key} --file ${file} --namespace ${bot_instance}
# TODO check if signing worked (just check exit code == 0)
sig_file=${file}.sig
aws_sig_file=${aws_file}.sig

# uploading signature
Expand Down Expand Up @@ -319,11 +324,16 @@ for file in "$*"; do
aws_path=$(envsubst <<< "${metadata_prefix}")
fi
# 2nd sign metadata file, and upload signature
if [[ "${sign}" = "1" ]]; then
if [[ "${sign}" = "yes" ]]; then
sig_metadata_file=${metadata_file}.sig
# delete sig file if it already exists
if [[ -f "${sig_metadata_file}" ]]; then
rm -f ${sig_metadata_file}
echo "INFO: removed existing signature file (${sig_metadata_file})"
fi
# sign metadata file
${sign_script} --sign --private-key ${sign_key} --file ${metadata_file} --namespace ${bot_instance}
# TODO check if signing worked (just check exit code == 0)
sig_metadata_file=${metadata_file}.sig
aws_sig_metadata_file=${aws_metadata_file}.sig

echo " store metadata signature at ${aws_path}/${aws_sig_metadata_file}"
Expand Down