summaryrefslogtreecommitdiffstats
path: root/ci/envs
diff options
context:
space:
mode:
Diffstat (limited to 'ci/envs')
-rwxr-xr-xci/envs/guest-setup0.sh8
-rwxr-xr-xci/envs/host-setup0.sh8
-rwxr-xr-xci/envs/utils.sh23
3 files changed, 37 insertions, 2 deletions
diff --git a/ci/envs/guest-setup0.sh b/ci/envs/guest-setup0.sh
index 4f9eaa430..301d34cbe 100755
--- a/ci/envs/guest-setup0.sh
+++ b/ci/envs/guest-setup0.sh
@@ -8,9 +8,15 @@
## http://www.apache.org/licenses/LICENSE-2.0
###############################################################################
+source utils.sh
+KERNEL_VERSION=$( getKernelVersion )
+if [ -z $KERNEL_VERSION ];then
+ echo "Kernel RPM not found"
+ exit 1
+fi
rpmdir=${1:-"/root/workspace/rpm"}
-rpmpat="kernel-4.4*.rpm"
+rpmpat="kernel-${KERNEL_VERSION}*.rpm"
guest_isolcpus=1
# The script's caller should passing the rpm directory that is built out from
diff --git a/ci/envs/host-setup0.sh b/ci/envs/host-setup0.sh
index 28c49b8b8..0778aae96 100755
--- a/ci/envs/host-setup0.sh
+++ b/ci/envs/host-setup0.sh
@@ -9,10 +9,16 @@
## http://www.apache.org/licenses/LICENSE-2.0
###############################################################################
+source utils.sh
source host-config
+KERNEL_VERSION=$( getKernelVersion )
+if [ -z $KERNEL_VERSION ];then
+ echo "Kernel RPM not found"
+ exit 1
+fi
rpmdir=${1:-"/root/workspace/rpm/"}
-rpmpat="kernel-4.4*.rpm"
+rpmpat="kernel-${KERNEL_VERSION}*.rpm"
config_grub () {
key=$1
diff --git a/ci/envs/utils.sh b/ci/envs/utils.sh
new file mode 100755
index 000000000..f582b5aac
--- /dev/null
+++ b/ci/envs/utils.sh
@@ -0,0 +1,23 @@
+#!/bin/bash
+###############################################################################
+# This script is to fetch kernel version and host ip at run time.
+###############################################################################
+
+#To get the Kernel version from RPM generated(example:kernel-4.4.6_rt14_1607061504nfv-3.x86_64.rpm)
+function getKernelVersion {
+ rpm_dir="/root/workspace/rpm/"
+ if [ -d "$WORKSPACE" ];then
+ cd $WORKSPACE/build_output 2>/dev/null; kernelRPM=`ls kernel-[[:digit:]]* 2>/dev/null`
+ RPMVERSION=`echo ${kernelRPM}|awk -F '_' '{print $1}' | awk -F '-' '{print $NF}'`
+ elif [ -d "$rpm_dir" ];then
+ cd $rpm_dir 2>/dev/null; kernelRPM=`ls kernel-[[:digit:]]* 2>/dev/null`
+ RPMVERSION=`echo ${kernelRPM}|awk -F '_' '{print $1}' | awk -F '-' '{print $NF}'`
+ fi
+ echo ${RPMVERSION}
+}
+
+#Get the IP address from pod.yaml file (example ip : 10.2.117.23)
+function getHostIP {
+ HOST_IP=`grep 'ip' $WORKSPACE/tests/pod.yaml | awk -F ': ' '{print $NF}' | tail -1`
+ echo $HOST_IP
+}