Merge "Add Vuls security test for x86_64"
[validation.git] / bluval / blucon.sh
1 #!/bin/bash
2
3 ##############################################################################
4 # Copyright (c) 2019 AT&T, ENEA Nokia and others                             #
5 #                                                                            #
6 # Licensed under the Apache License, Version 2.0 (the "License");            #
7 # you maynot use this file except in compliance with the License.            #
8 #                                                                            #
9 # You may obtain a copy of the License at                                    #
10 #       http://www.apache.org/licenses/LICENSE-2.0                           #
11 #                                                                            #
12 # Unless required by applicable law or agreed to in writing, software        #
13 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT  #
14 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.           #
15 # See the License for the specific language governing permissions and        #
16 # limitations under the License.                                             #
17 ##############################################################################
18
19 if [ -z "$AKRAINO_HOME" ]
20 then
21     echo "AKRAINO_HOME not available. Setting..."
22     this_file="$(readlink -f $0)"
23     bluval_dir="$(dirname $this_file)"
24     validation_dir="$(dirname $bluval_dir)"
25     parent_dir="$(dirname $validation_dir)"
26     export AKRAINO_HOME="$parent_dir"
27 fi
28 echo "AKRAINO_HOME=$AKRAINO_HOME"
29
30 if [ "$#" -eq 0 ]
31 then
32     echo 'Usage: sh blucon.sh [OPTIONS] BLUEPRINT
33
34     Invokes blucon.py and passes parameters as it is.
35     You can pass all the parameters blucon.py accepts,
36     and as of now here is the list
37
38     Options:
39         -l, --layer TEXT
40         -n, --network TEXT
41         -o, --optional_also
42         --help               Show this message and exit.'
43
44     exit 1
45 fi
46
47 echo "Building docker image"
48 image_tag=$( (git branch || echo "* local") | grep "^\*" | awk '{print $2}')
49 docker build -t akraino/validation:blucon-$image_tag $AKRAINO_HOME/validation/bluval
50
51 set -x
52
53 docker run --rm \
54     -v /var/run/docker.sock:/var/run/docker.sock \
55     -v $AKRAINO_HOME/results:/opt/akraino/results \
56     -v $AKRAINO_HOME/validation:/opt/akraino/validation \
57     akraino/validation:blucon-$image_tag "$@"