8 # check to see if we already have an artifact on artifacts.opnfv.org
10 echo "Checking to see if we already built and stored Fuel ISO for this commit"
12 LATEST_ISO_PROPERTIES=$WORKSPACE/latest.iso.properties
13 curl -s -o $LATEST_ISO_PROPERTIES http://$GS_URL/latest.properties 2>/dev/null
15 # get metadata of latest ISO
16 LATEST_ISO_SHA1=$(grep OPNFV_GIT_SHA1 $LATEST_ISO_PROPERTIES | cut -d'=' -f2)
17 LATEST_ISO_URL=$(grep OPNFV_ARTIFACT_URL $LATEST_ISO_PROPERTIES | cut -d'=' -f2)
20 CURRENT_SHA1=$(git rev-parse HEAD)
22 if [[ "$CURRENT_SHA1" == "$LATEST_ISO_SHA1" ]]; then
23 echo "An ISO has already been built for this commit"
24 echo " $LATEST_ISO_URL"
25 echo "Nothing new to build. Exiting."
28 echo "This commit has not been built yet. Proceeding with the build."
29 /bin/rm -f $LATEST_ISO_PROPERTIES
34 echo "Starting the build of $INSTALLER_TYPE. This could take some time..."
35 echo "--------------------------------------------------------"
38 # create the cache directory if it doesn't exist
39 mkdir -p $CACHE_DIRECTORY
41 # set OPNFV_ARTIFACT_VERSION
42 if [[ "$JOB_NAME" =~ "merge" ]]; then
43 echo "Building Fuel ISO for a merged change"
44 export OPNFV_ARTIFACT_VERSION="gerrit-$GERRIT_CHANGE_NUMBER"
46 export OPNFV_ARTIFACT_VERSION=$(date -u +"%Y-%m-%d_%H-%M-%S")
49 NOCACHE_PATTERN="verify: no-cache"
50 if [[ "$JOB_NAME" =~ "verify" && "$GERRIT_CHANGE_COMMIT_MESSAGE" =~ "$NOCACHE_PATTERN" ]]; then
51 echo "The cache will not be used for this build!"
54 NOCACHE_ARG=${{NOCACHE_ARG:-}}
58 ./build.sh -v $OPNFV_ARTIFACT_VERSION $NOCACHE_ARG -c file://$CACHE_DIRECTORY $BUILD_DIRECTORY
60 # list the build artifacts
61 ls -al $BUILD_DIRECTORY
63 # save information regarding artifact into file
65 echo "OPNFV_ARTIFACT_VERSION=$OPNFV_ARTIFACT_VERSION"
66 echo "OPNFV_GIT_URL=$(git config --get remote.origin.url)"
67 echo "OPNFV_GIT_SHA1=$(git rev-parse HEAD)"
68 echo "OPNFV_ARTIFACT_URL=$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso"
69 echo "OPNFV_ARTIFACT_MD5SUM=$(md5sum $BUILD_DIRECTORY/opnfv-$OPNFV_ARTIFACT_VERSION.iso | cut -d' ' -f1)"
70 echo "OPNFV_BUILD_URL=$BUILD_URL"
71 ) > $WORKSPACE/opnfv.properties
74 echo "--------------------------------------------------------"