[VAL-87] Bluval Containerization 89/2089/14
authorNaga Sugguna <ns156u@att.com>
Tue, 3 Dec 2019 07:21:14 +0000 (07:21 +0000)
committerNaga Sugguna <ns156u@att.com>
Thu, 12 Dec 2019 20:41:19 +0000 (20:41 +0000)
Intention of this change is to simplify BluVal installation

Now steps should be
1. clone the project
2. Update variables.yaml & volumes.yaml
3. ./blucon.sh -l <hardware> -o -n host <bluprint name>

blucon.sh builds the docker image takes few minutes first time
later on it should be quick.

Change-Id: I4b00e00baecc6d7eb81595d1d8866af67e2c53cf
Signed-off-by: Naga Sugguna <ns156u@att.com>
.coafile
bluval/Dockerfile [new file with mode: 0644]
bluval/blucon.sh [new file with mode: 0755]
bluval/requirements.txt

index 50e636c..fd4a0cc 100644 (file)
--- a/.coafile
+++ b/.coafile
@@ -1,6 +1,7 @@
 [all]
 ignore = .tox/**,
     .py35/**,
 [all]
 ignore = .tox/**,
     .py35/**,
+    .py36/**,
     .git/**,
     .gitignore,
     .gitreview,
     .git/**,
     .gitignore,
     .gitreview,
diff --git a/bluval/Dockerfile b/bluval/Dockerfile
new file mode 100644 (file)
index 0000000..08753f7
--- /dev/null
@@ -0,0 +1,30 @@
+##############################################################################
+# Copyright (c) 2019 AT&T, ENEA Nokia and others                             #
+#                                                                            #
+# Licensed under the Apache License, Version 2.0 (the "License");            #
+# you maynot use this file except in compliance with the License.            #
+#                                                                            #
+# You may obtain a copy of the License at                                    #
+#       http://www.apache.org/licenses/LICENSE-2.0                           #
+#                                                                            #
+# Unless required by applicable law or agreed to in writing, software        #
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT  #
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.           #
+# See the License for the specific language governing permissions and        #
+# limitations under the License.                                             #
+##############################################################################
+
+# ref: https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#use-multi-stage-builds
+FROM ubuntu:18.04 as build
+
+RUN apt-get update && apt-get -y install git python3-pip python3.6
+
+# Build binaries
+RUN git clone https://gerrit.akraino.org/r/validation /opt/akraino/validation
+RUN pip3 install -r /opt/akraino/validation/bluval/requirements.txt
+
+ENV LC_ALL=C.UTF-8
+ENV LANG=C.UTF-8
+
+WORKDIR /opt/akraino/validation
+ENTRYPOINT  ["python3", "bluval/blucon.py"]
\ No newline at end of file
diff --git a/bluval/blucon.sh b/bluval/blucon.sh
new file mode 100755 (executable)
index 0000000..3cc1e5e
--- /dev/null
@@ -0,0 +1,58 @@
+#!/bin/bash
+
+##############################################################################
+# Copyright (c) 2019 AT&T, ENEA Nokia and others                             #
+#                                                                            #
+# Licensed under the Apache License, Version 2.0 (the "License");            #
+# you maynot use this file except in compliance with the License.            #
+#                                                                            #
+# You may obtain a copy of the License at                                    #
+#       http://www.apache.org/licenses/LICENSE-2.0                           #
+#                                                                            #
+# Unless required by applicable law or agreed to in writing, software        #
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT  #
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.           #
+# See the License for the specific language governing permissions and        #
+# limitations under the License.                                             #
+##############################################################################
+
+if [ -z "$AKRAINO_HOME" ]
+then
+    echo "AKRAINO_HOME not available. Setting..."
+    this_file="$(readlink -f $0)"
+    bluval_dir="$(dirname $this_file)"
+    validation_dir="$(dirname $bluval_dir)"
+    parent_dir="$(dirname $validation_dir)"
+    export AKRAINO_HOME="$parent_dir"
+fi
+echo "AKRAINO_HOME=$AKRAINO_HOME"
+
+if [ "$#" -eq 0 ]
+then
+    echo 'Usage: sh blucon.sh [OPTIONS] BLUEPRINT
+
+    Invokes blucon.py and passes parameters as it is.
+    You can pass all the parameters blucon.py accepts,
+    and as of now here is the list
+
+    Options:
+        -l, --layer TEXT
+        -n, --network TEXT
+        -o, --optional_also
+        --help               Show this message and exit.'
+
+    exit 1
+fi
+
+echo "Building docker image"
+image_tag=$( (git branch || echo "* local") | grep "^\*" | awk '{print $2}')
+docker build -t akraino/validation:blucon-$image_tag $AKRAINO_HOME/validation/bluval
+
+set -x
+
+docker run --rm \
+    -v /var/run/docker.sock:/var/run/docker.sock \
+    -v /usr/bin/docker:/usr/bin/docker \
+    -v $AKRAINO_HOME/results:/opt/akraino/results \
+    -v $AKRAINO_HOME/validation:/opt/akraino/validation \
+    akraino/validation:blucon-$image_tag "$@"
index bdd48f9..7784bcd 100644 (file)
@@ -1,2 +1,7 @@
 pyyaml
 click
 pyyaml
 click
+robotframework
+robotframework-httplibrary
+robotframework-jsonlibrary
+robotframework-requests
+robotframework-sshlibrary