@@ -222,17 +222,17 @@ set -- "${POSITIONAL_ARGS[@]}"
222
222
223
223
# ensure that either none or both of $sign_key and $sign_script are defined
224
224
if [[ -n " ${sign_key} " ]] && [[ -n " ${sign_script} " ]]; then
225
- sign=1
225
+ sign=yes
226
226
elif [[ -n " ${sign_key} " ]]; then
227
- sign=0
227
+ sign=no
228
228
echo " Error: Signing requires a key (${sign_key} ) AND a script (${sign_script} ); likely the bot config is incomplete" >&2
229
229
exit 1
230
230
elif [[ -n " ${sign_script} " ]]; then
231
- sign=0
231
+ sign=no
232
232
echo " Error: Signing requires a key (${sign_key} ) AND a script (${sign_script} ); likely the bot config is incomplete" >&2
233
233
exit 1
234
234
else
235
- sign=0
235
+ sign=no
236
236
fi
237
237
238
238
# infer bucket_base:
@@ -268,11 +268,16 @@ for file in "$*"; do
268
268
fi
269
269
aws_file=$( basename ${file} )
270
270
# 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
272
278
# sign artefact
273
279
${sign_script} --sign --private-key ${sign_key} --file ${file} --namespace ${bot_instance}
274
280
# TODO check if signing worked (just check exit code == 0)
275
- sig_file=${file} .sig
276
281
aws_sig_file=${aws_file} .sig
277
282
278
283
# uploading signature
@@ -319,11 +324,16 @@ for file in "$*"; do
319
324
aws_path=$( envsubst <<< " ${metadata_prefix}" )
320
325
fi
321
326
# 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
323
334
# sign metadata file
324
335
${sign_script} --sign --private-key ${sign_key} --file ${metadata_file} --namespace ${bot_instance}
325
336
# TODO check if signing worked (just check exit code == 0)
326
- sig_metadata_file=${metadata_file} .sig
327
337
aws_sig_metadata_file=${aws_metadata_file} .sig
328
338
329
339
echo " store metadata signature at ${aws_path} /${aws_sig_metadata_file} "
0 commit comments