blob: dfdbe5969bdd24429607125213d9c343d62b711e [file] [log] [blame]
garciadeblasa1fc4572017-04-24 19:08:21 +02001#!/bin/bash
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14#
15# install is run on a host to install a MDG from binaries
16#
17
18
19HERE=$(realpath $(dirname $0))
20OSM_JENKINS=$(dirname $HERE)
21. $OSM_JENKINS/common/all_funcs
22
23[ $# -lt 1 ] && FATAL "arg is MDG name"
24
25export OSM_MDG=$1
26shift
27OSM_load_config
28
29if ! container_exists $OSM_BUILD_CONTAINER; then
30 CONTAINER_OPTS=""
31 [[ "$OSM_BUILD_CONTAINER_PRIVILEGED" == yes ]] && CONTAINER_OPTS="$CONTAINER_OPTS -c security.privileged=true"
32 [[ "$OSM_BUILD_CONTAINER_ALLOW_NESTED" == yes ]] && CONTAINER_OPTS="$CONTAINER_OPTS -c security.nesting=true"
33 create_container $OSM_BASE_IMAGE $OSM_BUILD_CONTAINER $CONTAINER_OPTS
34 wait_container_up $OSM_BUILD_CONTAINER
Mike Marchetti425f8ce2017-06-15 13:02:16 -040035 if [ ${OSM_USE_LOCAL_DEVOPS:-false} != false ]; then
garciadeblasa1fc4572017-04-24 19:08:21 +020036 container_push_devops $OSM_BUILD_CONTAINER
37 else
38 container_exec $OSM_BUILD_CONTAINER git clone ${OSM_GIT_URL}/devops
39 fi
40else
Mike Marchetti425f8ce2017-06-15 13:02:16 -040041 if [ ${OSM_USE_LOCAL_DEVOPS:-false} != false ]; then
garciadeblasa1fc4572017-04-24 19:08:21 +020042 container_push_devops $OSM_BUILD_CONTAINER
43 else
44 container_exec $OSM_BUILD_CONTAINER git -C devops pull
45 fi
46fi
47
48container_exec $OSM_BUILD_CONTAINER ./devops/jenkins/$OSM_MDG/install $*
49RC=$?
50INFO "$OSM_MDG install complete. Return code was $RC"
51exit $RC
52