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