summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFatih Degirmenci <fatih.degirmenci@ericsson.com>2017-06-21 23:06:52 +0000
committerGerrit Code Review <gerrit@opnfv.org>2017-06-21 23:06:52 +0000
commite9383ded0d640e372d29c3d191ef68868ea0aa02 (patch)
tree184f7d6c03c095bb15014b29e6acd0450e300511
parent96ba57c04478dce1f51620337d6287f14eb8152d (diff)
parent7437dc5f56d265accd415d87d58fb38c3f6ee7c9 (diff)
Merge "barometer: update daily job with artifacts build"
-rw-r--r--jjb/barometer/barometer-build.sh21
-rw-r--r--jjb/barometer/barometer-upload-artifact.sh40
-rw-r--r--jjb/barometer/barometer.yml20
3 files changed, 76 insertions, 5 deletions
diff --git a/jjb/barometer/barometer-build.sh b/jjb/barometer/barometer-build.sh
new file mode 100644
index 000000000..e40841bc2
--- /dev/null
+++ b/jjb/barometer/barometer-build.sh
@@ -0,0 +1,21 @@
+set -x
+
+OPNFV_ARTIFACT_VERSION=$(date -u +"%Y-%m-%d_%H-%M-%S")
+OPNFV_ARTIFACT_URL="$GS_URL/$OPNFV_ARTIFACT_VERSION/"
+
+# log info to console
+echo "Starting the build of Barometer RPMs"
+echo "------------------------------------"
+echo
+
+cd ci
+./install_dependencies.sh
+./build_rpm.sh
+cd $WORKSPACE
+
+# save information regarding artifact into file
+(
+ echo "OPNFV_ARTIFACT_VERSION=$OPNFV_ARTIFACT_VERSION"
+ echo "OPNFV_ARTIFACT_URL=$OPNFV_ARTIFACT_URL"
+) > $WORKSPACE/opnfv.properties
+
diff --git a/jjb/barometer/barometer-upload-artifact.sh b/jjb/barometer/barometer-upload-artifact.sh
new file mode 100644
index 000000000..996de4808
--- /dev/null
+++ b/jjb/barometer/barometer-upload-artifact.sh
@@ -0,0 +1,40 @@
+#!/bin/bash
+set -o nounset
+set -o pipefail
+
+RPM_WORKDIR=$WORKSPACE/rpmbuild
+RPM_DIR=$RPM_WORKDIR/RPMS/x86_64/
+cd $WORKSPACE/
+
+# source the opnfv.properties to get ARTIFACT_VERSION
+source $WORKSPACE/opnfv.properties
+
+# upload property files
+gsutil cp $WORKSPACE/opnfv.properties gs://$OPNFV_ARTIFACT_URL/opnfv.properties > gsutil.properties.log 2>&1
+gsutil cp $WORKSPACE/opnfv.properties gs://$GS_URL/latest.properties > gsutil.latest.log 2>&1
+
+echo "Uploading the barometer RPMs to artifacts.opnfv.org"
+echo "---------------------------------------------------"
+echo
+
+gsutil -m cp -r $RPM_DIR/* $OPNFV_ARTIFACT_URL > $WORKSPACE/gsutil.log 2>&1
+
+# Check if the RPMs were pushed
+gsutil ls $OPNFV_ARTIFACT_URL > /dev/null 2>&1
+if [[ $? -ne 0 ]]; then
+ echo "Problem while uploading barometer RPMs to $OPNFV_ARTIFACT_URL!"
+ echo "Check log $WORKSPACE/gsutil.log on the appropriate build server"
+ exit 1
+fi
+
+gsutil -m setmeta \
+ -h "Cache-Control:private, max-age=0, no-transform" \
+ gs://$OPNFV_ARTIFACT_URL/*.rpm > /dev/null 2>&1
+
+echo
+echo "--------------------------------------------------------"
+echo "Done!"
+echo "Artifact is available at $OPNFV_ARTIFACT_URL"
+
+#cleanup the RPM repo from the build machine.
+rm -rf $RPM_WORKDIR
diff --git a/jjb/barometer/barometer.yml b/jjb/barometer/barometer.yml
index 68b8a04c0..c8fb9e25b 100644
--- a/jjb/barometer/barometer.yml
+++ b/jjb/barometer/barometer.yml
@@ -144,8 +144,18 @@
- timed: '@midnight'
builders:
- - shell: |
- pwd
- cd ci
- ./install_dependencies.sh
- ./build_rpm.sh
+ - shell:
+ !include-raw-escape: ./barometer-build.sh
+ - shell:
+ !include-raw-escape: ./barometer-upload-artifact.sh
+
+########################
+# parameter macros
+########################
+- parameter:
+ name: barometer-project-parameter
+ parameters:
+ - string:
+ name: GS_URL
+ default: '$GS_BASE{gs-pathname}'
+ description: "URL to Google Storage."