@@ -10,30 +10,48 @@ pushd postgres-release
1010 CURRENT_VERSION=$( cat ../yq-release/version)
1111
1212 sha256_col=$( grep -n " ^SHA-256$" ../yq-release/checksums_hashes_order | cut -f1 -d:)
13- expected_sha256=$( awk -v col=" $(( sha256 _col + 1 )) " ' /^yq_linux_amd64[[:space:]]/{print $col}' ../yq-release/checksums)
14- actual_sha256=$( sha256sum ../yq-release/yq_linux_amd64 | awk ' {print $1}' )
15- if [ " $expected_sha256 " != " $actual_sha256 " ]; then
16- echo " SHA-256 verification failed for yq_linux_amd64"
17- echo " Expected: $expected_sha256 "
18- echo " Actual: $actual_sha256 "
19- exit 1
20- fi
21- echo " SHA-256 verified: $actual_sha256 "
22- cp ../yq-release/yq_linux_amd64 ../yq-bin/yq && chmod +x ../yq-bin/yq
2313
24- mv ../yq-release/yq_linux_amd64 ../yq-release/postgres-yq-${CURRENT_VERSION}
25- BLOB_PATH=$( ls ../yq-release/postgres-yq-${CURRENT_VERSION} )
26- FILENAME=$( basename ${BLOB_PATH} )
27- OLD_BLOB_PATH=$( cat config/blobs.yml | grep " postgres-yq" | cut -f1 -d:)
28- if ! echo " ${CURRENT_BLOBS} " | grep " ${FILENAME} " ; then
14+ for ARCH in amd64 arm64; do
15+ src_file=" yq_linux_${ARCH} "
16+ blob_name=" postgres-yq-${ARCH} -${CURRENT_VERSION} "
17+
18+ expected_sha256=$( awk -v col=" $(( sha256 _col + 1 )) " " /^${src_file} [[:space:]]/{print \$ col}" ../yq-release/checksums)
19+ actual_sha256=$( sha256sum " ../yq-release/${src_file} " | awk ' {print $1}' )
20+ if [ " $expected_sha256 " != " $actual_sha256 " ]; then
21+ echo " SHA-256 verification failed for ${src_file} "
22+ echo " Expected: $expected_sha256 "
23+ echo " Actual: $actual_sha256 "
24+ exit 1
25+ fi
26+ echo " SHA-256 verified for ${src_file} : $actual_sha256 "
27+
28+ cp " ../yq-release/${src_file} " " ../yq-release/${blob_name} "
29+
30+ if ! echo " ${CURRENT_BLOBS} " | grep -q " ${blob_name} " ; then
31+ NEED_COMMIT=true
32+ echo " adding ${blob_name} "
33+ bosh add-blob --sha2 " ../yq-release/${blob_name} " " yq/${blob_name} "
34+ fi
35+ done
36+
37+ # Remove any old yq blobs that are not the current amd64 or arm64 blobs
38+ while IFS= read -r old_blob; do
39+ echo " removing old blob: ${old_blob} "
40+ bosh remove-blob " ${old_blob} "
2941 NEED_COMMIT=true
30- echo " adding ${FILENAME} "
31- bosh add-blob --sha2 " ${BLOB_PATH} " " yq/${FILENAME} "
32- bosh remove-blob ${OLD_BLOB_PATH}
42+ done < <( grep " ^yq/" config/blobs.yml \
43+ | grep -vF " postgres-yq-amd64-${CURRENT_VERSION} " \
44+ | grep -vF " postgres-yq-arm64-${CURRENT_VERSION} " \
45+ | cut -f1 -d:)
46+
47+ if [ " ${NEED_COMMIT} " = " true" ]; then
3348 bosh upload-blobs
3449 fi
3550
36- if ${NEED_COMMIT} ; then
51+ # Always populate yq-bin from amd64 binary (CI workers are x86_64)
52+ cp ../yq-release/yq_linux_amd64 ../yq-bin/yq && chmod +x ../yq-bin/yq
53+
54+ if [ " ${NEED_COMMIT} " = " true" ]; then
3755 echo " -----> $( date) : Creating git commit"
3856 git config user.name " $GIT_USER_NAME "
3957 git config user.email " $GIT_USER_EMAIL "
@@ -44,4 +62,4 @@ pushd postgres-release
4462 git commit -am " Bump packages"
4563 fi
4664 fi
47- popd
65+ popd
0 commit comments