@@ -10,48 +10,30 @@ 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
1323
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} "
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
4129 NEED_COMMIT=true
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
30+ echo " adding ${FILENAME} "
31+ bosh add-blob --sha2 " ${BLOB_PATH} " " yq/${FILENAME} "
32+ bosh remove-blob ${OLD_BLOB_PATH}
4833 bosh upload-blobs
4934 fi
5035
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
36+ if ${NEED_COMMIT} ; then
5537 echo " -----> $( date) : Creating git commit"
5638 git config user.name " $GIT_USER_NAME "
5739 git config user.email " $GIT_USER_EMAIL "
@@ -62,4 +44,4 @@ pushd postgres-release
6244 git commit -am " Bump packages"
6345 fi
6446 fi
65- popd
47+ popd
0 commit comments