diff options
author | Tim Rozet <trozet@redhat.com> | 2018-11-15 17:28:18 -0500 |
---|---|---|
committer | Tim Rozet <trozet@redhat.com> | 2018-11-16 09:16:14 -0500 |
commit | fbe5dfee30f419fece03fb4bf5c27bcfae7abd8c (patch) | |
tree | 4bd7db49162f5a022ed6c3702ca6ed57f9c993b3 /jjb/apex/apex-snapshot-deploy.sh | |
parent | 52c5465d56e30e94d8fb177ec8b3c8268de96297 (diff) |
Apex: Refactor snapshot pipeline for other types
This patch changes snapshot related scripts to allow for more than just
the current snapshot type of "csit". This allows us to add other
snapshot types, including the functest type. The same
snapshot.properties file will be used to store information for all types
of snapshots. The snap cache folder structure will remain the same, but
hold different types of snapshots in the same folders.
These changes include renaming the URLs for the snapshot artifacts to
reflect the snapshot type, but remains backwards compatible until enough
promotions have occurred and other apex snapshot deployment scripts have
been migrated to the new format.
Change-Id: If3e47e700b5ad9c95418179042b85814fe389233
Signed-off-by: Tim Rozet <trozet@redhat.com>
Diffstat (limited to 'jjb/apex/apex-snapshot-deploy.sh')
-rw-r--r-- | jjb/apex/apex-snapshot-deploy.sh | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/jjb/apex/apex-snapshot-deploy.sh b/jjb/apex/apex-snapshot-deploy.sh index bd023f558..dd69df3fc 100644 --- a/jjb/apex/apex-snapshot-deploy.sh +++ b/jjb/apex/apex-snapshot-deploy.sh @@ -20,6 +20,11 @@ echo "Deploying Apex snapshot..." echo "--------------------------" echo +if [ -z "$SNAP_TYPE" ]; then + echo "ERROR: SNAP_TYPE not provided...exiting" + exit 1 +fi + echo "Cleaning server" pushd ci > /dev/null sudo opnfv-clean @@ -37,7 +42,7 @@ echo "Properties contents:" cat ${WORKSPACE}/opnfv.properties # find latest check sum -latest_snap_checksum=$(cat ${WORKSPACE}/opnfv.properties | grep OPNFV_SNAP_SHA512SUM | awk -F "=" '{print $2}') +latest_snap_checksum=$(cat ${WORKSPACE}/opnfv.properties | grep ${SNAP_TYPE}_SNAP_SHA512SUM | awk -F "=" '{print $2}') if [ -z "$latest_snap_checksum" ]; then echo "ERROR: checksum of latest snapshot from snapshot.properties is null!" exit 1 @@ -49,7 +54,7 @@ SNAP_CACHE=${SNAP_CACHE}/${OS_VERSION}/${TOPOLOGY} # check snap cache directory exists # if snapshot cache exists, find the checksum if [ -d "$SNAP_CACHE" ]; then - latest_snap=$(ls ${SNAP_CACHE} | grep tar.gz | tail -n 1) + latest_snap=$(ls ${SNAP_CACHE} | grep tar.gz | grep $SNAP_TYPE | tail -n 1) if [ -n "$latest_snap" ]; then local_snap_checksum=$(sha512sum ${SNAP_CACHE}/${latest_snap} | cut -d' ' -f1) echo "Local snap checksum is: ${local_snap_checksum}" @@ -60,7 +65,12 @@ fi # compare check sum and download latest snap if not up to date if [ "$local_snap_checksum" != "$latest_snap_checksum" ]; then - snap_url=$(cat opnfv.properties | grep OPNFV_SNAP_URL | awk -F "=" '{print $2}') + snap_url=$(cat opnfv.properties | grep ${SNAP_TYPE}_SNAP_URL | awk -F "=" '{print $2}') + # TODO(trozet): Remove this once OPNFV url is deprecated + if [[ -z "$snap_url" && "$SNAP_TYPE" == 'csit' ]]; then + echo "WARN: Unable to find snap url for ${SNAP_TYPE}, attempting to use OPNFV" + snap_url=$(cat opnfv.properties | grep OPNFV_SNAP_URL | awk -F "=" '{print $2}') + fi if [ -z "$snap_url" ]; then echo "ERROR: Snap URL from snapshot.properties is null!" exit 1 |