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-create.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-create.sh')
-rw-r--r-- | jjb/apex/apex-snapshot-create.sh | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/jjb/apex/apex-snapshot-create.sh b/jjb/apex/apex-snapshot-create.sh index f91720883..e8bf60bd2 100644 --- a/jjb/apex/apex-snapshot-create.sh +++ b/jjb/apex/apex-snapshot-create.sh @@ -28,7 +28,7 @@ tmp_dir=$(pwd)/.tmp mkdir -p ${tmp_dir} # info should have already been collected in apex-fetch-snap-info so copy it -cp -r /tmp/csit/* ${tmp_dir}/ +cp -r /tmp/snap/* ${tmp_dir}/ echo "Shutting down nodes" # Shut down nodes @@ -76,19 +76,30 @@ sudo rm -rf ${tmp_dir} echo "Snapshot saved as apex-${SNAP_TYPE}-snap-${DATE}.tar.gz" # update opnfv properties file -if [ "$SNAP_TYPE" == 'csit' ]; then - snap_sha=$(sha512sum apex-csit-snap-${DATE}.tar.gz | cut -d' ' -f1) - if curl --fail -O -L http://$GS_URL/snapshot.properties; then +snap_sha=$(sha512sum apex-${SNAP_TYPE}-snap-${DATE}.tar.gz | cut -d' ' -f1) + +if curl --fail -O -L http://$GS_URL/snapshot.properties; then + # TODO(trozet): deprecate OPNFV_SNAP_URL for CSIT_SNAP_URL + if [ "$SNAP_TYPE" == 'csit' ]; then sed -i '/^OPNFV_SNAP_URL=/{h;s#=.*#='${GS_URL}'/apex-csit-snap-'${DATE}'.tar.gz#};${x;/^$/{s##OPNFV_SNAP_URL='${GS_URL}'/apex-csit-snap-'${DATE}'.tar.gz#;H};x}' snapshot.properties sed -i '/^OPNFV_SNAP_SHA512SUM=/{h;s/=.*/='${snap_sha}'/};${x;/^$/{s//OPNFV_SNAP_SHA512SUM='${snap_sha}'/;H};x}' snapshot.properties - else - cat << EOF > snapshot.properties + fi + sed -i '/^'${SNAP_TYPE}'_SNAP_URL=/{h;s#=.*#='${GS_URL}'/apex-'${SNAP_TYPE}'-snap-'${DATE}'.tar.gz#};${x;/^$/{s##'${SNAP_TYPE}'_SNAP_URL='${GS_URL}'/apex-'${SNAP_TYPE}'-snap-'${DATE}'.tar.gz#;H};x}' snapshot.properties + sed -i '/^'${SNAP_TYPE}'_SNAP_SHA512SUM=/{h;s/=.*/='${snap_sha}'/};${x;/^$/{s//'${SNAP_TYPE}'_SNAP_SHA512SUM='${snap_sha}'/;H};x}' snapshot.properties +else + cat << EOF > snapshot.properties +${SNAP_TYPE}_SNAP_URL=${GS_URL}/apex-${SNAP_TYPE}-snap-${DATE}.tar.gz +${SNAP_TYPE}_SNAP_SHA512SUM=${snap_sha} +EOF + # TODO(trozet): deprecate OPNFV_SNAP_URL for CSIT_SNAP_URL + if [ "$SNAP_TYPE" == 'csit' ]; then + cat << EOF >> snapshot.properties OPNFV_SNAP_URL=${GS_URL}/apex-csit-snap-${DATE}.tar.gz OPNFV_SNAP_SHA512SUM=${snap_sha} EOF fi - echo "OPNFV_SNAP_URL=$GS_URL/apex-csit-snap-${DATE}.tar.gz" - echo "OPNFV_SNAP_SHA512SUM=$(sha512sum apex-csit-snap-${DATE}.tar.gz | cut -d' ' -f1)" - echo "Updated properties file: " - cat snapshot.properties fi +echo "${SNAP_TYPE}_SNAP_URL=$GS_URL/apex-${SNAP_TYPE}-snap-${DATE}.tar.gz" +echo "${SNAP_TYPE}_SNAP_SHA512SUM=$(sha512sum apex-${SNAP_TYPE}-snap-${DATE}.tar.gz | cut -d' ' -f1)" +echo "Updated properties file: " +cat snapshot.properties |