Fix Sonobuoy systemd-image for k8 1.18
[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     AKRAINO_HOME="$(readlink -f "$(dirname "$0")/../..")"
23 fi
24
25 # Allow overriding VALIDATION_DIR and/or RESULTS_DIR via env vars
26 VALIDATION_DIR=${VALIDATION_DIR:-"${AKRAINO_HOME}/validation"}
27 RESULTS_DIR=${RESULTS_DIR:-"${AKRAINO_HOME}/results"}
28
29 echo "AKRAINO_HOME=$AKRAINO_HOME"
30 echo "VALIDATION_DIR=$VALIDATION_DIR"
31 echo "RESULTS_DIR=$RESULTS_DIR"
32
33 if [ "$#" -eq 0 ]
34 then
35     echo 'Usage: sh blucon.sh [OPTIONS] BLUEPRINT
36
37     Invokes blucon.py and passes parameters as it is.
38     You can pass all the parameters blucon.py accepts,
39     and as of now here is the list
40
41     Options:
42         -l, --layer TEXT
43         -n, --network TEXT
44         -t, --tag TEXT
45         -o, --optional_also
46         --help               Show this message and exit.'
47
48     exit 1
49 fi
50
51 echo "Building docker image"
52 img="akraino/validation:blucon-$(git rev-parse --abbrev-ref HEAD || echo local)"
53 docker build -t "$img" "$VALIDATION_DIR/bluval"
54
55 set -x
56
57 docker run --rm \
58     -v /var/run/docker.sock:/var/run/docker.sock \
59     -v "$RESULTS_DIR":/opt/akraino/results \
60     -v "$VALIDATION_DIR":/opt/akraino/validation \
61     "$img" "$@"