summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas F Herbert <therbert@redhat.com>2015-12-13 23:22:43 -0500
committerThomas F Herbert <therbert@redhat.com>2015-12-18 06:41:21 -0500
commitae9133bb8eb8322d411722617f667e01df63d5b9 (patch)
tree7fa6c47d41096101d816b5dce02b087f2cbb663b
parent1adea4369e52d835e7210a79cf2e0e15cb4d52c7 (diff)
Script to build plain OVS RPM from master.
Uploads RPM to artifactory. Jira: OVSNFV-19 Change-Id: I586418a5e12435fd9d1594a4d2aca544c16a3a6d Signed-off-by: Thomas F Herbert <therbert@redhat.com>
-rw-r--r--build/config5
-rwxr-xr-xci/build.sh5
-rwxr-xr-xci/buildovs.sh174
-rwxr-xr-xci/upload_artifacts.sh24
4 files changed, 208 insertions, 0 deletions
diff --git a/build/config b/build/config
new file mode 100644
index 0000000..337e07d
--- /dev/null
+++ b/build/config
@@ -0,0 +1,5 @@
+# config file to be populated with configuration parameters for build.
+
+# OVS TAG
+export OVSTAG=master
+#export NOCHECK=true
diff --git a/ci/build.sh b/ci/build.sh
index 18cb2c3..5272b21 100755
--- a/ci/build.sh
+++ b/ci/build.sh
@@ -1,5 +1,10 @@
#!/bin/bash
+DIR=`pwd`
echo "Hello OVSNFV community!"
+echo "Build ovs RPM for Linux kernel data plane from master branch of OVS."
+
+$DIR/buildovs.sh
+
exit 0
diff --git a/ci/buildovs.sh b/ci/buildovs.sh
new file mode 100755
index 0000000..b731bd1
--- /dev/null
+++ b/ci/buildovs.sh
@@ -0,0 +1,174 @@
+#!/bin/bash
+##############################################################################
+# Copyright (c) 2015 Red Hat Inc. and others.
+# therbert@redhat.com
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
+# Check to verify that I am being run by Jenkins CI.
+
+if [ -z ${WORKSPACE+1} ]; then
+ # We are not being run by Jenkins.
+ export WORKSPACE=$HOME/opnfv/ovsnfv
+else
+ export JENKINS=true
+fi
+
+
+if [ -z ${OVSTAG+1} ]; then
+ export TAG=master
+else
+ export TAG=$OVSTAG
+fi
+
+export DATE=`date +%Y-%m-%d`
+
+export BUILD_BASE=$WORKSPACE/build
+
+
+
+if [ ! -d $BUILD_BASE ]
+then
+ mkdir -p $BUILD_BASE
+ if [ ! -f $BUILD_BASE/config ]; then
+ touch $BUILd_BASE/config
+ fi
+fi
+
+export PATH=$PATH:$WORKSPACE/ci:$BUILD_BASE
+
+source $BUILD_BASE/config
+
+cd $BUILD_BASE
+export TOPDIR=$BUILD_BASE
+
+# build variables
+
+export TMP_RELEASE_DIR=$TOPDIR/release
+export CACHE_DIR=$TOPDIR/cache
+export TMPDIR=$TOPDIR/scratch
+export RPMDIR=$TOPDIR/rpmbuild
+
+echo "--------------------------------------------------"
+echo "Build OVS RPM from upstream git $TAG"
+echo
+
+mkdir -p $RPMDIR/BUILD
+mkdir -p $RPMDIR/RPMS
+mkdir -p $RPMDIR/SOURCES
+mkdir -p $RPMDIR/SPECS
+mkdir -p $RPMDIR/SRPMS
+
+if [ ! -d $TMP_RELEASE_DIR ]
+then
+ mkdir -p $TMP_RELEASE_DIR
+fi
+
+# Centos build server should support the following build prerequisites
+
+# yum install gcc make python-devel openssl-devel kernel-devel graphviz \
+# kernel-debug-devel autoconf automake rpm-build redhat-rpm-config \
+# libtool
+
+if [ -d $TMPDIR ]
+then
+ rm -rf $TMPDIR
+fi
+
+mkdir $TMPDIR
+
+cd $TMPDIR
+
+echo "---------------------"
+echo "Clone git repo $TAG"
+echo
+git clone https://github.com/openvswitch/ovs.git
+
+cd ovs
+echo "--------------------"
+echo "Checkout OVS $TAG"
+echo
+if [[ ! "$TAG" =~ "master" ]]; then
+ git checkout $TAG
+fi
+./boot.sh
+./configure
+echo "--------------------"
+echo "Make OVS $TAG"
+echo
+make
+#
+# Get version for master
+#
+echo "--------------------"
+echo "Get OVS version for $TAG"
+echo
+if [[ "$TAG" =~ "master" ]]; then
+ v=$($TMPDIR/ovs/utilities/ovs-vsctl --version | head -1 | cut -d' ' -f4)
+ export VERSION=$v
+else
+ export VERSION=${TAG:1}
+fi
+
+echo "--------------------"
+echo "OVS version is $VERSION"
+echo
+echo "--------------------"
+echo "Make OVS distribution $TAG"
+echo
+
+make dist
+
+cd $TMPDIR/ovs
+
+cp openvswitch-$VERSION.tar.gz $TOPDIR/rpmbuild/SOURCES
+cp openvswitch-$VERSION.tar.gz $TMPDIR
+
+cd $TMPDIR
+tar -xzf openvswitch-$VERSION.tar.gz
+
+cd $TMPDIR/openvswitch-$VERSION
+
+
+echo "--------------------"
+echo "Build OVS RPM"
+echo
+
+if [ ! -z ${NOCHECK+1} ]; then
+ # Build RPM without checks
+ #
+ rpmbuild -bb --define "_topdir `echo $RPMDIR`" --without check rhel/openvswitch.spec
+else
+ rpmbuild -bb --define "_topdir `echo $RPMDIR`" rhel/openvswitch.spec
+fi
+
+# Once build is done copy product to artifactory.
+
+echo "---------------------------------------"
+echo "Copy RPM into $TMP_RELEASE_DIR"
+echo
+cp $RPMDIR/RPMS/x86_64/*.rpm $TMP_RELEASE_DIR
+
+# cleanup
+
+echo "---------------------------------------"
+echo "Cleanup $TMP_RELEASE_DIR"
+echo
+cd $BUILDDIR
+
+if [ -d $TMPDIR ]
+then
+ echo rm -rf $TMPDIR
+ rm -rf $TMPDIR
+fi
+
+# copy artifacts.
+
+if [ ! -z ${JENKINS+1} ]; then
+ upload_artifacts.sh
+fi
+
+exit 0
diff --git a/ci/upload_artifacts.sh b/ci/upload_artifacts.sh
new file mode 100755
index 0000000..765a336
--- /dev/null
+++ b/ci/upload_artifacts.sh
@@ -0,0 +1,24 @@
+#!/bin/bash
+set -o errexit
+set -o nounset
+set -o pipefail
+
+# log info to console
+echo "Uploading the OVS $VERSION RPM artifacts. "
+echo "-----------------------------------------"
+echo
+
+export RPMFILE_D=openvswitch-debuginfo-$VERSION-1.x86_64.rpm
+export RPMFILE=openvswitch-$VERSION-1.x86_64.rpm
+
+# upload artifact and additional files to google storage
+echo gsutil cp $TMP_RELEASE_DIR/$RPMFILE_D gs://artifacts.opnfv.org/ovsnfv/opnfv-$DATE-$RPMFILE_D
+gsutil cp $TMP_RELEASE_DIR/$RPMFILE_D gs://artifacts.opnfv.org/ovsnfv/opnfv-$DATE-$RPMFILE_D
+
+echo gsutil cp $TMP_RELEASE_DIR/$RPMFILE gs://artifacts.opnfv.org/ovsnfv/opnfv-$DATE-$RPMFILE
+gsutil cp $TMP_RELEASE_DIR/$RPMFILE gs://artifacts.opnfv.org/ovsnfv/opnfv-$DATE-$RPMFILE
+
+echo
+echo "------------------------------------------------------"
+echo "Done!"
+echo "Artifacts are available as http://artifacts.opnfv.org/ovsnfv/opnfv-$DATE-$RPMFILE"