This is an automated email from the ASF dual-hosted git repository.

djwang pushed a commit to branch merge-with-upstream
in repository https://gitbox.apache.org/repos/asf/cloudberry-pxf.git

commit 45efced0e188cb782098ddd50bf06f97397c3de5
Author: Ashuka Xue <[email protected]>
AuthorDate: Thu Sep 15 15:21:14 2022 -0700

    ci: allow existing artifacts to remain if there is no pivnet product (#868)
    
    In the case that there is no pivnet artifact to pull down, do not error
    out. Instead, keep whatever artifact was already present in the bucket.
---
 concourse/scripts/get_product_files.bash | 30 ++++++++++++++++++++++++------
 1 file changed, 24 insertions(+), 6 deletions(-)

diff --git a/concourse/scripts/get_product_files.bash 
b/concourse/scripts/get_product_files.bash
index f00024bb..9175adeb 100755
--- a/concourse/scripts/get_product_files.bash
+++ b/concourse/scripts/get_product_files.bash
@@ -32,12 +32,30 @@ versions=$(echo "${versions}" | grep -v 
"${GPDB_VERSION}\.99\.99")
 num_gpdb_versions=$(echo "${versions}" | wc -l)
 echo "Number of versions: ${num_gpdb_versions}"
 
-# if `VERSIONS_BEFORE_LATEST` is out of range, use the oldest available version
-if ((VERSIONS_BEFORE_LATEST >= num_gpdb_versions)); then
-       echo "VERSION_BEFORE_LATEST (${VERSIONS_BEFORE_LATEST}) exceeds number 
of versions (${num_gpdb_versions}) on GCS for Greenplum ${GPDB_VERSION}"
-       VERSIONS_BEFORE_LATEST=$((num_gpdb_versions - 1))
-       echo "Update VERSIONS_BEFORE_LATEST to ${VERSIONS_BEFORE_LATEST}"
-fi
+       if [[ -z "${id}" ]]; then
+               echo "Did not find '${file}' in product files for GPDB 
'${gpdb_version}'"
+
+               case "${file}" in
+                       *rhel7*) existing_file="$(find ${product_dirs[$i]}/ 
-name *rhel7*.rpm)" ;;
+                       *rhel8*) existing_file="$(find ${product_dirs[$i]}/ 
-name *rhel8*.rpm)" ;;
+                       *ubuntu18*) existing_file="$(find ${product_dirs[$i]}/ 
-name *ubuntu18*.deb)" ;;
+                       *)
+                               echo "Unexpected file: ${file}"
+                               exit 1;;
+               esac
+
+               echo "Keeping existing file: ${existing_file}"
+               continue
+       fi
+       echo "Cleaning ${product_dirs[$i]} and downloading ${file} with id 
${id} to ${product_dirs[$i]}..."
+       rm -f "${product_dirs[$i]}"/*.{rpm,deb}
+       pivnet download-product-files \
+               "--download-dir=${product_dirs[$i]}" \
+               "--product-slug=${PRODUCT_SLUG}" \
+               "--release-version=${gpdb_version}" \
+               "--product-file-id=${id}" >/dev/null 2>&1 &
+       pids+=($!)
+done
 
 # get the `VERSIONS_BEFORE_LATEST`-th (zero-based index) latest version
 target_version=$(echo "${versions}" | awk -v i=${VERSIONS_BEFORE_LATEST} 'NR 
== i+1')


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to