Skip to content

Commit 5ff1b77

Browse files
authored
Merge pull request #309 from trz42/remove_pre_existing_sig_files
delete pre-existing signature files + small fixes
2 parents 5a97702 + 772a626 commit 5ff1b77

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

scripts/eessi-upload-to-staging

+18-8
Original file line numberDiff line numberDiff line change
@@ -222,17 +222,17 @@ set -- "${POSITIONAL_ARGS[@]}"
222222

223223
# ensure that either none or both of $sign_key and $sign_script are defined
224224
if [[ -n "${sign_key}" ]] && [[ -n "${sign_script}" ]]; then
225-
sign=1
225+
sign=yes
226226
elif [[ -n "${sign_key}" ]]; then
227-
sign=0
227+
sign=no
228228
echo "Error: Signing requires a key (${sign_key}) AND a script (${sign_script}); likely the bot config is incomplete" >&2
229229
exit 1
230230
elif [[ -n "${sign_script}" ]]; then
231-
sign=0
231+
sign=no
232232
echo "Error: Signing requires a key (${sign_key}) AND a script (${sign_script}); likely the bot config is incomplete" >&2
233233
exit 1
234234
else
235-
sign=0
235+
sign=no
236236
fi
237237

238238
# infer bucket_base:
@@ -268,11 +268,16 @@ for file in "$*"; do
268268
fi
269269
aws_file=$(basename ${file})
270270
# 1st sign artefact, and upload signature
271-
if [[ "${sign}" = "1" ]]; then
271+
if [[ "${sign}" = "yes" ]]; then
272+
sig_file=${file}.sig
273+
# delete sig file if it already exists
274+
if [[ -f "${sig_file}" ]]; then
275+
rm -f ${sig_file}
276+
echo "INFO: removed existing signature file (${sig_file})"
277+
fi
272278
# sign artefact
273279
${sign_script} --sign --private-key ${sign_key} --file ${file} --namespace ${bot_instance}
274280
# TODO check if signing worked (just check exit code == 0)
275-
sig_file=${file}.sig
276281
aws_sig_file=${aws_file}.sig
277282

278283
# uploading signature
@@ -319,11 +324,16 @@ for file in "$*"; do
319324
aws_path=$(envsubst <<< "${metadata_prefix}")
320325
fi
321326
# 2nd sign metadata file, and upload signature
322-
if [[ "${sign}" = "1" ]]; then
327+
if [[ "${sign}" = "yes" ]]; then
328+
sig_metadata_file=${metadata_file}.sig
329+
# delete sig file if it already exists
330+
if [[ -f "${sig_metadata_file}" ]]; then
331+
rm -f ${sig_metadata_file}
332+
echo "INFO: removed existing signature file (${sig_metadata_file})"
333+
fi
323334
# sign metadata file
324335
${sign_script} --sign --private-key ${sign_key} --file ${metadata_file} --namespace ${bot_instance}
325336
# TODO check if signing worked (just check exit code == 0)
326-
sig_metadata_file=${metadata_file}.sig
327337
aws_sig_metadata_file=${aws_metadata_file}.sig
328338

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

0 commit comments

Comments
 (0)