Add secret-management in Charmed OSM
[osm/devops.git] / jenkins / host / install
1 #!/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
19 HERE=$(realpath $(dirname $0))
20 OSM_JENKINS=$(dirname $HERE)
21 . $OSM_JENKINS/common/all_funcs
22
23 [ $# -lt 1 ] && FATAL "arg is MDG name"
24
25 export OSM_MDG=$1
26 shift
27 OSM_load_config
28
29 if ! 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
35         if [ ${OSM_USE_LOCAL_DEVOPS:-false} != false ]; then
36                 container_push_devops $OSM_BUILD_CONTAINER
37         else
38                 container_exec $OSM_BUILD_CONTAINER git clone ${OSM_GIT_URL}/devops
39         fi
40 else
41         if [ ${OSM_USE_LOCAL_DEVOPS:-false} != false ]; then
42                 container_push_devops $OSM_BUILD_CONTAINER
43         else
44                 container_exec $OSM_BUILD_CONTAINER git -C devops pull
45         fi
46 fi
47
48 container_exec $OSM_BUILD_CONTAINER ./devops/jenkins/$OSM_MDG/install $*
49 RC=$?
50 INFO "$OSM_MDG install complete. Return code was $RC"
51 exit $RC
52