Apex: Allow for multi-version snapshots 67/59767/1
authorTim Rozet <trozet@redhat.com>
Thu, 12 Jul 2018 14:32:40 +0000 (10:32 -0400)
committerTim Rozet <trozet@redhat.com>
Thu, 12 Jul 2018 14:32:40 +0000 (10:32 -0400)
This patch adds ability to manage multiple snapshot versions. We want to
be able to have snapshots for noha and ha for multiple OS releases. This
adds that capability and updates the deploy script to be able to deploy
them. Also a user can specify which scenario to trigger with his ODL
netvirt commit by doing 'opnfv-check <os version>-<ha|noha>

Change-Id: I3884b41c86b55c187becfb83ef62f3431724d09e
Signed-off-by: Tim Rozet <trozet@redhat.com>
jjb/3rd_party_ci/odl-netvirt.yaml
jjb/apex/apex-snapshot-deploy.sh
jjb/apex/apex.yaml
jjb/apex/apex.yaml.j2

index a326af4..c78de9b 100644 (file)
@@ -92,7 +92,7 @@
             #     comment-contains-value: 'https://jenkins.opendaylight.org/releng/job/netvirt-patch-test-current-carbon/.*?/ : UNSTABLE'
             # yamllint enable rule:line-length
             - comment-added-contains-event:
-                comment-contains-value: 'opnfv-test'
+                comment-contains-value: 'check-opnfv'
           projects:
             - project-compare-type: 'ANT'
               project-pattern: '{project}'
                 GERRIT_PATCHSET_REVISION=$GERRIT_PATCHSET_REVISION
                 NETVIRT_ARTIFACT=$NETVIRT_ARTIFACT
                 APEX_ENV_NUMBER=$APEX_ENV_NUMBER
+                GERRIT_EVENT_COMMENT_TEXT=$GERRIT_EVENT_COMMENT_TEXT
               node-parameters: true
               kill-phase-on: FAILURE
               abort-all-job: true
index 0760626..0a47506 100644 (file)
@@ -25,9 +25,31 @@ pushd ci > /dev/null
 sudo opnfv-clean
 popd > /dev/null
 
+echo "Detecting requested OpenStack branch and topology type in gerrit comment"
+parsed_comment=$(echo $GERRIT_EVENT_COMMENT_TEXT | sed -n 's/^opnfv-check\s*//p')
+parsed_comment=$(echo $parsed_comment | sed -n 's/\s*$//p')
+if [ ! -z "$parsed_comment" ]; then
+  if echo $parsed_comment | grep -E '^[a-z]+-(no)?ha'; then
+    IFS='-' read -r -a array <<< "$parsed_comment"
+    os_version=${array[0]}
+    topo=${array[1]}
+    echo "OS version detected in gerrit comment: ${os_version}"
+    echo "Topology type detected in gerrit comment: ${topo}"
+  else
+    echo "Invalid format given for scenario in gerrit comment: ${parsed_comment}...aborting"
+    exit 1
+  fi
+else
+  echo "No scenario given in gerrit comment, will use default (master OpenStack, noha)"
+  os_version='master'
+  topo='noha'
+fi
+
+full_snap_url=http://$GS_URL/${os_version}/${topo}
+
 echo "Downloading latest snapshot properties file"
-if ! wget -O $WORKSPACE/opnfv.properties http://$GS_URL/snapshot.properties; then
-  echo "ERROR: Unable to find snapshot.properties at ${GS_URL}...exiting"
+if ! wget -O $WORKSPACE/opnfv.properties ${full_snap_url}/snapshot.properties; then
+  echo "ERROR: Unable to find snapshot.properties at ${full_snap_url}...exiting"
   exit 1
 fi
 
@@ -39,6 +61,7 @@ if [ -z "$latest_snap_checksum" ]; then
 fi
 
 local_snap_checksum=""
+SNAP_CACHE=${SNAP_CACHE}/${os_version}/${topo}
 
 # check snap cache directory exists
 # if snapshot cache exists, find the checksum
index bf5f067..773577f 100644 (file)
@@ -8,7 +8,7 @@
       - 'apex-virtual-{stream}'
       - 'apex-deploy-{platform}-{stream}'
       - 'apex-daily-{stream}'
-      - 'apex-csit-promote-daily-{stream}-os-{os_version}'
+      - 'apex-csit-promote-daily-{stream}-os-{os_version}-{topology}'
       - 'apex-fdio-promote-daily-{stream}'
       - 'apex-{scenario}-baremetal-{scenario_stream}'
       - 'apex-testsuite-{scenario}-baremetal-{scenario_stream}'
       - 'master':
           os_scenario: 'nofeature'
 
+    topology:
+      - 'noha'
+      - 'ha'
 
 # Fetch Logs Job
 - job-template:
 
 # CSIT promote
 - job-template:
-    name: 'apex-csit-promote-daily-{stream}-os-{os_version}'
+    name: 'apex-csit-promote-daily-{stream}-os-{os_version}-{topology}'
 
     # Job template for promoting CSIT Snapshots
     #
           name: PROMOTE
           default: 'True'
           description: "Used for overriding the PROMOTE"
+      - string:
+          name: GS_URL
+          default: $GS_BASE{gs-pathname}/{os_version}/{topology}
+          description: "User for overriding GS_URL from apex params"
 
     properties:
       - build-blocker:
             - name: 'apex-virtual-{stream}'
               current-parameters: true
               predefined-parameters: |
-                DEPLOY_SCENARIO=os-odl-{os_scenario}-noha
+                DEPLOY_SCENARIO=os-odl-{os_scenario}-{topology}
                 OPNFV_CLEAN=yes
                 GERRIT_BRANCH=$GERRIT_BRANCH
                 GERRIT_REFSPEC=$GERRIT_REFSPEC
index df825d8..bc2c379 100644 (file)
@@ -8,7 +8,7 @@
       - 'apex-virtual-{stream}'
       - 'apex-deploy-{platform}-{stream}'
       - 'apex-daily-{stream}'
-      - 'apex-csit-promote-daily-{stream}-os-{os_version}'
+      - 'apex-csit-promote-daily-{stream}-os-{os_version}-{topology}'
       - 'apex-fdio-promote-daily-{stream}'
       - 'apex-{scenario}-baremetal-{scenario_stream}'
       - 'apex-testsuite-{scenario}-baremetal-{scenario_stream}'
@@ -81,6 +81,9 @@
       - 'master':
           os_scenario: 'nofeature'
 
+    topology:
+      - 'noha'
+      - 'ha'
 
 # Fetch Logs Job
 - job-template:
 
 # CSIT promote
 - job-template:
-    name: 'apex-csit-promote-daily-{stream}-os-{os_version}'
+    name: 'apex-csit-promote-daily-{stream}-os-{os_version}-{topology}'
 
     # Job template for promoting CSIT Snapshots
     #
           name: PROMOTE
           default: 'True'
           description: "Used for overriding the PROMOTE"
+      - string:
+          name: GS_URL
+          default: $GS_BASE{gs-pathname}/{os_version}/{topology}
+          description: "User for overriding GS_URL from apex params"
 
     properties:
       - build-blocker:
             - name: 'apex-virtual-{stream}'
               current-parameters: true
               predefined-parameters: |
-                DEPLOY_SCENARIO=os-odl-{os_scenario}-noha
+                DEPLOY_SCENARIO=os-odl-{os_scenario}-{topology}
                 OPNFV_CLEAN=yes
                 GERRIT_BRANCH=$GERRIT_BRANCH
                 GERRIT_REFSPEC=$GERRIT_REFSPEC