From: Tim Rozet Date: Fri, 22 Jun 2018 00:15:16 +0000 (-0400) Subject: Apex: more snapshot fixes X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=commitdiff_plain;ds=sidebyside;h=refs%2Fchanges%2F93%2F58893%2F1;p=releng.git Apex: more snapshot fixes Changes-Include: - Rename jobs to have 'os' in them to distinguish openstack branch - Fix uploading snapshots to upload from the create directory (where the artifacts are built and stored) - Fix the properties file so that it is created if one does not exist already upstream in the artifacts repo Change-Id: I0d75fd41585538cbe860274a082cb4051d8b05c5 Signed-off-by: Tim Rozet --- diff --git a/jjb/apex/apex-snapshot-create.sh b/jjb/apex/apex-snapshot-create.sh index 7e38d56b4..b73931470 100644 --- a/jjb/apex/apex-snapshot-create.sh +++ b/jjb/apex/apex-snapshot-create.sh @@ -91,10 +91,16 @@ echo "Snapshot saved as apex-${SNAP_TYPE}-snap-${DATE}.tar.gz" # update opnfv properties file if [ "$SNAP_TYPE" == 'csit' ]; then - curl -O -L http://$GS_URL/snapshot.properties - 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 snap_sha=$(sha512sum apex-csit-snap-${DATE}.tar.gz | cut -d' ' -f1) - sed -i '/^OPNFV_SNAP_SHA512SUM=/{h;s/=.*/='${snap_sha}'/};${x;/^$/{s//OPNFV_SNAP_SHA512SUM='${snap_sha}'/;H};x}' snapshot.properties + if curl --fail -O -L http://$GS_URL/snapshot.properties; 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 +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: " diff --git a/jjb/apex/apex-upload-artifact.sh b/jjb/apex/apex-upload-artifact.sh index 6acb2a582..5c777a824 100755 --- a/jjb/apex/apex-upload-artifact.sh +++ b/jjb/apex/apex-upload-artifact.sh @@ -77,13 +77,16 @@ uploadrpm () { uploadsnap () { # Uploads snapshot artifact and updated properties file echo "Uploading snapshot artifacts" + # snapshot dir is the same node in the create job workspace + # only 1 promotion job can run at a time on a slave + snapshot_dir="${WORKSPACE}/../apex-create-snapshot" if [ -z "$SNAP_TYPE" ]; then echo "ERROR: SNAP_TYPE not provided...exiting" exit 1 fi - gsutil cp $WORKSPACE/apex-${SNAP_TYPE}-snap-`date +%Y-%m-%d`.tar.gz gs://$GS_URL/ > gsutil.iso.log + gsutil cp ${snapshot_dir}/apex-${SNAP_TYPE}-snap-`date +%Y-%m-%d`.tar.gz gs://$GS_URL/ > gsutil.iso.log if [ "$SNAP_TYPE" == 'csit' ]; then - gsutil cp $WORKSPACE/snapshot.properties gs://$GS_URL/snapshot.properties > gsutil.latest.log + gsutil cp ${snapshot_dir}/snapshot.properties gs://$GS_URL/snapshot.properties > gsutil.latest.log fi echo "Upload complete for Snapshot" } diff --git a/jjb/apex/apex.yaml b/jjb/apex/apex.yaml index 249fb0a90..65e558820 100644 --- a/jjb/apex/apex.yaml +++ b/jjb/apex/apex.yaml @@ -8,7 +8,7 @@ - 'apex-virtual-{stream}' - 'apex-deploy-{platform}-{stream}' - 'apex-daily-{stream}' - - 'apex-csit-promote-daily-{stream}-{os_version}' + - 'apex-csit-promote-daily-{stream}-os-{os_version}' - 'apex-fdio-promote-daily-{stream}' - 'apex-{scenario}-baremetal-{scenario_stream}' - 'apex-testsuite-{scenario}-baremetal-{scenario_stream}' @@ -777,7 +777,7 @@ # CSIT promote - job-template: - name: 'apex-csit-promote-daily-{stream}-{os_version}' + name: 'apex-csit-promote-daily-{stream}-os-{os_version}' # Job template for promoting CSIT Snapshots # diff --git a/jjb/apex/apex.yaml.j2 b/jjb/apex/apex.yaml.j2 index 166e7a07b..f1208d27e 100644 --- a/jjb/apex/apex.yaml.j2 +++ b/jjb/apex/apex.yaml.j2 @@ -8,7 +8,7 @@ - 'apex-virtual-{stream}' - 'apex-deploy-{platform}-{stream}' - 'apex-daily-{stream}' - - 'apex-csit-promote-daily-{stream}-{os_version}' + - 'apex-csit-promote-daily-{stream}-os-{os_version}' - 'apex-fdio-promote-daily-{stream}' - 'apex-{scenario}-baremetal-{scenario_stream}' - 'apex-testsuite-{scenario}-baremetal-{scenario_stream}' @@ -649,7 +649,7 @@ # CSIT promote - job-template: - name: 'apex-csit-promote-daily-{stream}-{os_version}' + name: 'apex-csit-promote-daily-{stream}-os-{os_version}' # Job template for promoting CSIT Snapshots #