Upload and download Fuel ISOs in scope of fuel-merge jobs 61/3361/5
authorFatih Degirmenci <fatih.degirmenci@ericsson.com>
Tue, 17 Nov 2015 22:33:43 +0000 (23:33 +0100)
committerFatih Degirmenci <fatih.degirmenci@ericsson.com>
Fri, 20 Nov 2015 13:09:23 +0000 (13:09 +0000)
This is the first step towards enabling virtual deployments for Fuel
merge jobs. This change introduces
- storing the ISOs built by the merge jobs on OPNFV Artifact Repository
- downloading ISOs built by the merge jobs for virtual deployments

Once this gets merged, a second change will be sent for enabling the virtual
deployments using downloaded ISO.

Change-Id: I726f58d914c7c216e1ffe626c2ca250f56d08222
Signed-off-by: Fatih Degirmenci <fatih.degirmenci@ericsson.com>
jjb/fuel/fuel-build.sh
jjb/fuel/fuel-download-artifact.sh
jjb/fuel/fuel-upload-artifact.sh
jjb/fuel/fuel.yml

index 178a50c..63a62f4 100755 (executable)
@@ -12,7 +12,12 @@ echo
 [[ -d $CACHE_DIRECTORY ]] || mkdir -p $CACHE_DIRECTORY
 
 # set OPNFV_ARTIFACT_VERSION
-export OPNFV_ARTIFACT_VERSION=$(date -u +"%Y-%m-%d_%H-%M-%S")
+if [[ $GERRIT_EVENT_TYPE = "change-merged" ]]; then
+    echo "Building Fuel ISO for a merged change"
+    OPNFV_ARTIFACT_VERSION=$(gerrit-$GERRIT_CHANGE_NUMBER)
+else
+    OPNFV_ARTIFACT_VERSION=$(date -u +"%Y-%m-%d_%H-%M-%S")
+fi
 
 # start the build
 cd $WORKSPACE/$INSTALLER/ci
index 6eb1ba4..7ebc0d6 100755 (executable)
@@ -3,8 +3,13 @@ set -o errexit
 set -o nounset
 set -o pipefail
 
-# get the latest.properties file in order to get info regarding latest artifact
-curl -s -o $WORKSPACE/latest.properties http://$GS_URL/latest.properties
+if [[ $GERRIT_EVENT_TYPE = "change-merged" ]]; then
+    # get the properties file for the Fuel ISO built for a merged change
+    curl -s -o $WORKSPACE/opnfv-gerrit-$GERRIT_CHANGE_NUMBER.properties http://$GS_URL/latest.properties
+else
+    # get the latest.properties file in order to get info regarding latest artifact
+    curl -s -o $WORKSPACE/latest.properties http://$GS_URL/latest.properties
+fi
 
 # check if we got the file
 [[ -f latest.properties ]] || exit 1
index 3b700c6..a4bf32c 100755 (executable)
@@ -14,7 +14,11 @@ source $WORKSPACE/opnfv.properties
 # upload artifact and additional files to google storage
 gsutil cp $BUILD_DIRECTORY/opnfv-$OPNFV_ARTIFACT_VERSION.iso gs://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso > gsutil.iso.log 2>&1
 gsutil cp $WORKSPACE/opnfv.properties gs://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.properties > gsutil.properties.log 2>&1
-gsutil cp $WORKSPACE/opnfv.properties gs://$GS_URL/latest.properties > gsutil.latest.log 2>&1
+if [[ ! $GERRIT_EVENT_TYPE = "change-merged" ]]; then
+    gsutil cp $WORKSPACE/opnfv.properties gs://$GS_URL/latest.properties > gsutil.latest.log 2>&1
+else
+    echo "Uploaded Fuel ISO for a merged change"
+fi
 
 echo
 echo "--------------------------------------------------------"
index 1f53454..1625124 100644 (file)
     builders:
         - shell:
             !include-raw ./fuel-build.sh
-#        - shell:
-#            !include-raw ./fuel-upload-artifact.sh
-#        - shell:
-#            !include-raw ./fuel-workspace-cleanup.sh
+        - shell:
+            !include-raw ./fuel-upload-artifact.sh
+        - shell:
+            !include-raw ./fuel-workspace-cleanup.sh
 
 - job-template:
     name: 'fuel-merge-virtual-deploy-{stream}'
             dependency-jobs: 'fuel-merge-build-{stream}'
 
     builders:
-#        - shell:
-#            !include-raw ./fuel-download-artifact.sh
+        - shell:
+            !include-raw ./fuel-download-artifact.sh
         - shell:
             !include-raw ./fuel-virtual-deploy.sh
-#        - shell:
-#            !include-raw ./fuel-workspace-cleanup.sh
+        - shell:
+            !include-raw ./fuel-workspace-cleanup.sh
 
 - job-template:
     name: 'fuel-daily-{stream}'