Skip to content

Commit 98a8532

Browse files
committed
fix(upload_index.sh): upload parser one-liner
1 parent 420e8f3 commit 98a8532

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

manifests/src/upload_index.sh

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,8 @@ FILENAME=${FILE_TO_VERSION##*/}
2323
echo "Checking that S3 ETags match their local counterpart"
2424

2525
# Extract URLs and ETags
26-
url_column=$(head -n1 "${FILE_TO_VERSION}" | tr ',' '\n' | grep -n "url" | cut -d':' -f1)
27-
urls=$(awk -F',' -v col="${url_column}" 'NR>1 {gsub(/^"|"$/, "", $col); print $col}' "${FILE_TO_VERSION}")
28-
29-
etag_column=$(head -n1 "${FILE_TO_VERSION}" | tr ',' '\n' | grep -n "etag" | cut -d':' -f1)
30-
local_etags=$(awk -F',' -v col="${etag_column}" 'NR>1 {gsub(/^"|"$/, "", $col); print $col}' "${FILE_TO_VERSION}")
26+
urls=$(jq .[].url "${FILE_TO_VERSION}" | tr -d '"')
27+
local_etags=$(jq .[].etag "${FILE_TO_VERSION}" | tr -d '"')
3128

3229
s3_etags=""
3330
while IFS= read -r url; do
@@ -42,7 +39,7 @@ s3_etags=$(echo -e "${s3_etags}" | sed '/^$/d')
4239
s3_etags_hash=$(echo -e "${s3_etags}" | md5sum | cut -f1 -d" ")
4340
local_etags_hash=$(echo "${local_etags}" | md5sum | cut -f1 -d" ")
4441

45-
echo "Remote ${s3_etags_hash} vs Local ${local_etags_hash} values"
42+
echo "Remote ${s3_etags_hash} vs local ${local_etags_hash} values"
4643
if [ "${s3_etags_hash}" != "${local_etags_hash}" ]; then
4744
echo "At least one ETag does not match their url."
4845
exit 1

0 commit comments

Comments
 (0)