blob: c7abc7272ed1f5c81cd1f105261123be2cfc98ef [file] [log] [blame]
beierlm85dc2392021-04-14 13:51:53 -04001#!/bin/bash
2#######################################################################################
3# Copyright ETSI Contributors and Others.
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
14# implied.
15# See the License for the specific language governing permissions and
16# limitations under the License.
17#######################################################################################
18
beierlme7646252022-01-13 10:53:08 -050019APT_PROXY=""
beierlm85dc2392021-04-14 13:51:53 -040020DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
garciadeblas2c5b33f2023-04-13 11:00:14 +020021HTTPDDIR="${HOME}/.osm/httpd"
veleza05f3d9e2021-11-22 11:26:50 +000022HTTPPORT=8000
beierlm85dc2392021-04-14 13:51:53 -040023KUBECFG="~/.osm/microk8s-config.yaml"
24NO_CACHE=""
25OPENSTACKRC="/var/snap/microstack/common/etc/microstack.rc"
26REGISTRY="localhost:32000"
27ROOTDIR="$( cd "${DIR}/../../" &> /dev/null && pwd)"
David Garciaf0014df2021-06-16 10:37:34 +020028OSM_TESTS_IMAGE_TAG="devel"
beierlm85dc2392021-04-14 13:51:53 -040029
30function check_arguments(){
31 while [ $# -gt 0 ] ; do
32 case $1 in
33 --debug) set -x ;;
beierlme7646252022-01-13 10:53:08 -050034 --apt-proxy) APT_PROXY="$2" && shift ;;
beierlm85dc2392021-04-14 13:51:53 -040035 --help | -h) show_help && exit 0 ;;
garciadeblas2c5b33f2023-04-13 11:00:14 +020036 --httpddir) HTTPDDIR="$2" && shift;;
beierlm85dc2392021-04-14 13:51:53 -040037 --install-local-registry) 'install_local_registry' ;;
38 --install-microstack) 'install_microstack' ;;
39 --install-qhttpd) INSTALL_HTTPD='install_qhttpd' ;;
garciadeblas2c5b33f2023-04-13 11:00:14 +020040 --run-httpserver) INSTALL_HTTPD='run_httpserver' ;;
beierlm85dc2392021-04-14 13:51:53 -040041 --kubecfg) KUBECFG="$2" && shift ;;
42 --module) TARGET_MODULE="$2" && shift;;
43 --no-cache) NO_CACHE="--no-cache" ;;
44 --openstackrc) OPENSTACKRC="$2" && shift ;;
45 --registry) REGISTRY="$2" && shift;;
46 --robot-local-mounts) ROBOT_LOCAL=YES ;;
47 --run-tests) TESTS=YES ;;
David Garciaf0014df2021-06-16 10:37:34 +020048 --vim-vca) VIM_VCA="$2" && shift;;
49 --osm-tests-image-tag) OSM_TESTS_IMAGE_TAG="$2" && shift;;
beierlm85dc2392021-04-14 13:51:53 -040050 stage-2) STAGE_2='stage_2 ${TARGET_MODULE}' ;;
51 stage-3) STAGE_3='stage_3 ${TARGET_MODULE}' ;;
52 registry-push) REGISTRY_PUSH='local_registry_push ${TARGET_MODULE}' ;;
53 install-osm) INSTALL_OSM='install_osm' ;;
54 start-robot) START_ROBOT='start_robot' ;;
55 update-install) UPDATE_INSTALL='update_osm_module ${TARGET_MODULE}'
56 REGISTRY_PUSH='local_registry_push ${TARGET_MODULE}' ;;
57 *) echo "Unknown option $1"
58 show_help
59 exit 1;;
60 esac
61 shift
62 done
63}
64
65function show_help() {
66 cat << EOF
67Usage: $0 [OPTIONS]
68Perform a local build and potential installation of OSM from sources, using the
69same process as Jenkins.
70
71OPTIONS:
72 --help display this help message
beierlme7646252022-01-13 10:53:08 -050073 --apt-proxy provide an apt proxy to docker build steps
beierlm85dc2392021-04-14 13:51:53 -040074 --debug enable set -x for this script
beierlme7646252022-01-13 10:53:08 -050075 --install-local-registry install and enable Microk8s local registry on port 32000
beierlm85dc2392021-04-14 13:51:53 -040076 --install-microstack install Microstack and configure to run robot tests
garciadeblas2c5b33f2023-04-13 11:00:14 +020077 --install-qhttpd (deprecated, use --run-httpserver instead) install QHTTPD as an HTTP server on port ${HTTPPORT}
78 --run-httpserver run HTTP server on port ${HTTPPORT}
beierlm85dc2392021-04-14 13:51:53 -040079 --kubecfg path to kubecfg.yaml (uses Charmed OSM by default)
80 --no-cache do not use any cache when building docker images
81 --module only build this comma delimited list of modules
82 --openstackrc path to Openstack RC file (uses Microstack by default)
83 --registry use this alternate docker registry
84 --run-tests run stage 2 tests
David Garciaf0014df2021-06-16 10:37:34 +020085 --vim-vca name of the a vca registered in OSM to use in the VIM account
86 --osm-tests-image-tag tag to be used in the osm/tests docker image
beierlm85dc2392021-04-14 13:51:53 -040087 stage-2 run the stage 2 build
88 stage-3 run the stage 3 build
89 registry-push push to the local registry
90 install-osm perform full installation of Charmed OSM from registry
91 start-robot start the Robot test container and leave you at prompt
92 update-install update Charmed OSM with new module container
garciadeblas9f5e6d62022-04-22 10:20:08 +020093
94A typical use could be the following:
95
96Let's assume that we have different repos cloned in the folder workspace:
97
98 cd workspace
99 git clone https://osm.etsi.org/gerrit/osm/devops
100 git clone https://osm.etsi.org/gerrit/osm/NBI
101 git clone https://osm.etsi.org/gerrit/osm/LCM
102 git clone "https://osm.etsi.org/gerrit/osm/RO
103 git clone "https://osm.etsi.org/gerrit/osm/common
104 git clone "https://osm.etsi.org/gerrit/osm/IM
105 git clone "https://osm.etsi.org/gerrit/osm/N2VC
106
garciadeblas2c5b33f2023-04-13 11:00:14 +0200107First we run a light HTTP server to serve the artifacts:
garciadeblas9f5e6d62022-04-22 10:20:08 +0200108
garciadeblas2c5b33f2023-04-13 11:00:14 +0200109 devops/tools/local-build.sh --run-httpserver
garciadeblas9f5e6d62022-04-22 10:20:08 +0200110
111Then we generate the artifacts (debian packages) for the different repos: common, IM, N2VC, RO, LCM, NBI
112
113 devops/tools/local-build.sh --module common,IM,N2VC,RO,LCM,NBI stage-2
114
115Then new docker images are generated locally with the tag "devel" (e.g.: opensourcemano/lcm:devel):
116
117 devops/tools/local-build.sh --module RO,LCM,NBI stage-3
118
119Finally, the deployment of OSM will have to be updated to use the new docker images.
120
beierlm85dc2392021-04-14 13:51:53 -0400121EOF
122}
123
David Garciaf0014df2021-06-16 10:37:34 +0200124function print_section() {
125 echo "$@"
126}
127
beierlm85dc2392021-04-14 13:51:53 -0400128function install_local_registry() {
129 sudo snap install microk8s --classic
130 microk8s status --wait-ready
131 microk8s.enable registry
132}
133
134function install_microstack() {
135 sudo snap install microstack --devmode --edge
beierlm6535de32021-06-30 08:05:37 -0400136 sudo snap set microstack config.network.ports.dashboard=8080
beierlm85dc2392021-04-14 13:51:53 -0400137 sudo microstack.init --auto --control
138
139 sudo snap alias microstack.openstack openstack
140 . /var/snap/microstack/common/etc/microstack.rc
141
beierlm6535de32021-06-30 08:05:37 -0400142 for i in $(microstack.openstack security group list | awk '/default/{ print $2 }'); do
143 microstack.openstack security group rule create $i --protocol icmp --remote-ip 0.0.0.0/0
144 microstack.openstack security group rule create $i --protocol tcp --remote-ip 0.0.0.0/0
beierlm85dc2392021-04-14 13:51:53 -0400145 done
146
beierlm6535de32021-06-30 08:05:37 -0400147 microstack.openstack network create --enable --no-share osm-ext
148 microstack.openstack subnet create osm-ext-subnet --network osm-ext --dns-nameserver 8.8.8.8 \
beierlm85dc2392021-04-14 13:51:53 -0400149 --subnet-range 172.30.0.0/24
beierlm6535de32021-06-30 08:05:37 -0400150 microstack.openstack router create external-router
151 microstack.openstack router add subnet external-router osm-ext-subnet
152 microstack.openstack router set --external-gateway external external-router
beierlm85dc2392021-04-14 13:51:53 -0400153
154 curl -L https://github.com/cirros-dev/cirros/releases/download/0.3.5/cirros-0.3.5-x86_64-disk.img \
beierlm6535de32021-06-30 08:05:37 -0400155 | microstack.openstack image create --public --container-format=bare \
beierlm85dc2392021-04-14 13:51:53 -0400156 --disk-format=qcow2 cirros-0.3.5-x86_64-disk.img
157 curl https://cloud-images.ubuntu.com/xenial/current/xenial-server-cloudimg-amd64-disk1.img \
beierlm6535de32021-06-30 08:05:37 -0400158 | microstack.openstack image create --public --container-format=bare \
beierlm85dc2392021-04-14 13:51:53 -0400159 --disk-format=qcow2 ubuntu16.04
160 curl https://cloud-images.ubuntu.com/xenial/current/xenial-server-cloudimg-amd64-disk1.img \
beierlm6535de32021-06-30 08:05:37 -0400161 | microstack.openstack image create --public --container-format=bare \
beierlm85dc2392021-04-14 13:51:53 -0400162 --disk-format=qcow2 US1604
163 curl https://cloud-images.ubuntu.com/bionic/current/bionic-server-cloudimg-amd64.img \
beierlm6535de32021-06-30 08:05:37 -0400164 | microstack.openstack image create --public --container-format=bare \
beierlm85dc2392021-04-14 13:51:53 -0400165 --disk-format=qcow2 ubuntu18.04
166 curl https://cloud-images.ubuntu.com/focal/current/focal-server-cloudimg-amd64.img \
beierlm6535de32021-06-30 08:05:37 -0400167 | microstack.openstack image create --public --container-format=bare \
beierlm85dc2392021-04-14 13:51:53 -0400168 --disk-format=qcow2 ubuntu20.04
169}
170
garciadeblas2c5b33f2023-04-13 11:00:14 +0200171function create_httpddir() {
172 mkdir -p ${HTTPDDIR}
173}
174
beierlm85dc2392021-04-14 13:51:53 -0400175function install_qhttpd() {
176 sudo snap install qhttp
garciadeblas9f5e6d62022-04-22 10:20:08 +0200177 EXISTING_PID=$(ps auxw | grep "http.server $HTTPPORT" | grep -v grep | awk '{print $2}')
beierlm85dc2392021-04-14 13:51:53 -0400178 if [ ! -z $EXISTING_PID ] ; then
179 kill $EXISTING_PID
180 fi
181 qhttp -p ${HTTPPORT} &
182}
183
garciadeblas2c5b33f2023-04-13 11:00:14 +0200184function run_httpserver() {
185 EXISTING_PID=$(ps auxw | grep "http.server $HTTPPORT" | grep -v grep | awk '{print $2}')
186 if [ ! -z $EXISTING_PID ] ; then
187 kill $EXISTING_PID
188 fi
garciadeblas63868ab2023-04-20 10:04:55 +0200189 nohup python3 -m http.server ${HTTPPORT} --directory "${HTTPDDIR}" &>/dev/null &
garciadeblas2c5b33f2023-04-13 11:00:14 +0200190}
191
beierlm85dc2392021-04-14 13:51:53 -0400192function stage_2() {
David Garciaf0014df2021-06-16 10:37:34 +0200193 print_section "Performing Stage 2"
khelifi81a1a222025-04-28 09:35:51 +0100194 MODULES="common devops IM LCM MON N2VC NBI NG-UI NG-SA osmclient RO tests"
beierlm85dc2392021-04-14 13:51:53 -0400195 if [ ! -z ${1} ] ; then
196 POSSIBLE_MODULES=$(echo ${1} | sed "s/,/ /g")
197 for MODULE in ${POSSIBLE_MODULES}; do
198 if ! echo "${MODULES}" | grep -q "${MODULE}" ; then
199 echo "Unknown stage 2 module ${MODULE}"
200 echo "Must be one of ${MODULES}"
201 exit 1
202 fi
203 done
204 MODULES=${POSSIBLE_MODULES}
205 else
David Garciaf0014df2021-06-16 10:37:34 +0200206 print_section "Cleaning HTTP Directory for full build"
beierlm85dc2392021-04-14 13:51:53 -0400207 rm -fv ${HTTPDDIR}/*.deb
208 fi
209
210 for MODULE in ${MODULES} ; do
211 cd "${ROOTDIR}"
212 if [ ! -d ${MODULE} ] ; then
213 echo "Directory ${ROOTDIR}/${MODULE} does not exist"
214 exit 1
215 fi
David Garciaf0014df2021-06-16 10:37:34 +0200216 print_section "Building ${MODULE}"
beierlm85dc2392021-04-14 13:51:53 -0400217 cd ${MODULE}
218 find . -name '*.deb' -exec rm -v {} \;
beierlme7646252022-01-13 10:53:08 -0500219
220 BUILD_ARGS=""
221 if [ ! -z $APT_PROXY ] ; then
222 BUILD_ARGS="${BUILD_ARGS}--build-arg APT_PROXY=${APT_PROXY} "
223 fi
224 docker build ${NO_CACHE} ${BUILD_ARGS} -t ${MODULE,,}-stage2 .
beierlm85dc2392021-04-14 13:51:53 -0400225
226 STAGES="stage-build.sh"
227 if [ ! -z $TESTS ] ; then
228 STAGES="stage-test.sh ${STAGES}"
229 fi
230 for STAGE in $STAGES ; do
231 docker run -ti \
232 -v "$(pwd):/build" \
233 -w /build \
234 ${MODULE,,}-stage2 \
235 bash -c "groupadd -o -g $(id -g) -r $USER ;
236 useradd -o -u $(id -u) -d /build -r -g $USER $USER ;
237 runuser $USER -c devops-stages/${STAGE}"
238 if [ $? -ne 0 ] ; then
David Garciaf0014df2021-06-16 10:37:34 +0200239 print_section "Failed to build ${MODULE}"
beierlm85dc2392021-04-14 13:51:53 -0400240 exit 1
241 fi
242 done
243
244 find . -name '*.deb' -exec mv -v {} ${HTTPDDIR}/ \;
245 done
246}
247
248function _find_module_dockerfile() {
249 cd "${ROOTDIR}/devops/docker"
250 MODULES=`find . -name Dockerfile -printf '%h\n' |sed 's|\./||' |sort |tr '\n' ' '`
251 if [ ! -z ${1} ] ; then
252 POSSIBLE_MODULES=$(echo ${1} | sed "s/,/ /g")
253 for MODULE in ${POSSIBLE_MODULES}; do
254 if ! echo "${MODULES}" | grep -q "${MODULE}" ; then
255 echo "Unknown stage 3 module ${MODULE}"
256 echo "Must be one of ${MODULES}"
257 exit 1
258 fi
259 done
260 echo ${POSSIBLE_MODULES}
261 else
262 echo ${MODULES}
263 fi
264}
265
266function stage_3() {
David Garciaf0014df2021-06-16 10:37:34 +0200267 print_section "Performing Stage 3"
beierlm85dc2392021-04-14 13:51:53 -0400268 MODULES=$(_find_module_dockerfile $1)
269 BUILD_ARGS=""
beierlme7646252022-01-13 10:53:08 -0500270 if [ ! -z $APT_PROXY ] ; then
271 BUILD_ARGS="${BUILD_ARGS}--build-arg APT_PROXY=${APT_PROXY} "
272 fi
273
beierlm85dc2392021-04-14 13:51:53 -0400274 HOSTIP=$(ip -4 addr show docker0 | grep -Po 'inet \K[\d.]+')
garciadeblas2c5b33f2023-04-13 11:00:14 +0200275 [ -z "$DEFAULT_IF" ] && DEFAULT_IF=$(ip route list|awk '$1=="default" {print $5; exit}')
276 [ -z "$DEFAULT_IF" ] && DEFAULT_IF=$(route -n |awk '$1~/^0.0.0.0/ {print $8; exit}')
277 DEFAULT_IP=$(ip -o -4 a s ${DEFAULT_IF} |awk '{split($4,a,"/"); print a[1]; exit}')
278 HOSTIP=${HOSTIP:=${DEFAULT_IP}}
279 echo $HOSTIP
280
281 for file in ${HTTPDDIR}/*.deb ; do
beierlm85dc2392021-04-14 13:51:53 -0400282 file=`basename ${file}`
283 name=`echo ${file} | cut -d_ -f1 | sed "s/-/_/g"`;
284 name=${name^^}_URL
285 BUILD_ARGS="${BUILD_ARGS}--build-arg ${name}=http://$HOSTIP:${HTTPPORT}/$file "
286 echo Added ${name} as http://$HOSTIP:${HTTPPORT}/$file
287 done
288
289 for MODULE in ${MODULES} ; do
290 cd "${ROOTDIR}/devops/docker"
291 if [ ! -d ${MODULE} ] ; then
292 echo "Directory ${ROOTDIR}/${MODULE} does not exist"
293 exit 1
294 fi
David Garciaf0014df2021-06-16 10:37:34 +0200295 print_section "Building ${MODULE}"
beierlm85dc2392021-04-14 13:51:53 -0400296 cd ${MODULE}
297 MODULE=${MODULE,,}
298 docker build ${NO_CACHE} -t opensourcemano/${MODULE}:devel ${BUILD_ARGS} .
299 if [ $? -ne 0 ] ; then
David Garciaf0014df2021-06-16 10:37:34 +0200300 print_section "Failed to build ${MODULE}"
beierlm85dc2392021-04-14 13:51:53 -0400301 exit 1
302 fi
303 done
304}
305
306function local_registry_push() {
David Garciaf0014df2021-06-16 10:37:34 +0200307 print_section "Pushing to local registry"
beierlm85dc2392021-04-14 13:51:53 -0400308 cd "${ROOTDIR}/devops/docker"
309 MODULES=`find . -name Dockerfile -printf '%h\n' |sed 's|\./||' |sort |tr '\n' ' '`
310 if [ ! -z ${1} ] ; then
311 POSSIBLE_MODULES=$(echo ${1} | sed "s/,/ /g")
312 for MODULE in ${POSSIBLE_MODULES}; do
313 echo "${MODULE}"
314 if ! echo "${MODULES}" | grep -q "${MODULE}" ; then
315 echo "Unknown stage 3 module ${MODULE}"
316 echo "Must be one of ${MODULES}"
317 exit 1
318 fi
319 done
320 MODULES=${POSSIBLE_MODULES}
321 fi
322 for MODULE in ${MODULES} ; do
323 MODULE=${MODULE,,}
324 docker tag opensourcemano/${MODULE}:devel ${REGISTRY}/opensourcemano/${MODULE}:devel
325 docker push ${REGISTRY}/opensourcemano/${MODULE}:devel
326 done
327}
328
329function install_osm() {
330 cd "${ROOTDIR}/devops/installers"
331 VCA=""
332 if juju controllers 2>/dev/null| grep osm-vca ; then
333 VCA="--vca osm-vca"
334 fi
335 ./charmed_install.sh --registry localhost:32000 --tag devel ${VCA}
336}
337
338function start_robot() {
339 mkdir -p "${ROOTDIR}/tests/local"
340 cd "${ROOTDIR}/tests/local"
341
342 . ${OPENSTACKRC}
343
344 # Workaround for microstack auth URL
345 if [ ${OPENSTACKRC} == "/var/snap/microstack/common/etc/microstack.rc" ] ; then
346 export OS_AUTH_URL=${OS_AUTH_URL}/v3
347 fi
348
349 export OSM_HOSTNAME=$(juju config -m osm nbi site_url | sed "s/http.*\?:\/\///"):443
350 export PROMETHEUS_HOSTNAME=$(juju config -m osm prometheus site_url | sed "s/http.*\?:\/\///")
351 export PROMETHEUS_PORT=80
352 export JUJU_PASSWORD=`juju gui 2>&1 | grep password | awk '{print $2}'`
David Garciaf0014df2021-06-16 10:37:34 +0200353 export HOSTIP=$(echo $PROMETHEUS_HOSTNAME | sed "s/prometheus.//" | sed "s/.nip.io//")
beierlm85dc2392021-04-14 13:51:53 -0400354
355 rm robot-systest.cfg
356 for line in `env | grep "^OS_" | sort` ; do echo $line >> robot-systest.cfg ; done
357 cat << EOF >> robot-systest.cfg
358VIM_TARGET=osm
359VIM_MGMT_NET=osm-ext
360ENVIRONMENTS_FOLDER=environments
361PACKAGES_FOLDER=/robot-systest/osm-packages
362OS_CLOUD=openstack
363LC_ALL=C.UTF-8
364LANG=C.UTF-8
365EOF
366
367 cat << EOF > robot.etc.hosts
368127.0.0.1 localhost
David Garciaf0014df2021-06-16 10:37:34 +0200369${HOSTIP} prometheus.${HOSTIP}.nip.io nbi.${HOSTIP}.nip.io
beierlm85dc2392021-04-14 13:51:53 -0400370EOF
371 cat << EOF > clouds.yaml
372clouds:
373 openstack:
374 auth:
375 auth_url: $OS_AUTH_URL
376 project_name: $OS_PROJECT_NAME
377 username: $OS_USERNAME
378 password: $OS_PASSWORD
379 user_domain_name: $OS_USER_DOMAIN_NAME
380 project_domain_name: $OS_PROJECT_DOMAIN_NAME
381EOF
382
383 VIM_AUTH_URL=$(osm vim-show osm | grep vim_url | awk '{print $4}' | tr -d \")
David Garciaf0014df2021-06-16 10:37:34 +0200384 if [[ ! -z ${VIM_AUTH_URL} && "$OS_AUTH_URL" != "${VIM_AUTH_URL}" ]] ; then
beierlm85dc2392021-04-14 13:51:53 -0400385 echo "Deleting existing VIM osm as auth URLs have changed"
386 osm vim-delete osm
387 fi
388
389 if ! osm vim-show osm &> /dev/null ; then
390 echo "Creating VIM osm"
David Garciaf0014df2021-06-16 10:37:34 +0200391 if [ -v VIM_VCA ]; then
392 VCA_OPT="--vca $VIM_VCA"
393 fi
394 osm vim-create --name osm $VCA_OPT --user "$OS_USERNAME" --password "$OS_PASSWORD" \
beierlm85dc2392021-04-14 13:51:53 -0400395 --auth_url "$OS_AUTH_URL" --tenant "$OS_USERNAME" --account_type openstack \
396 --config='{use_floating_ip: True,
397 management_network_name: osm-ext}'
398 fi
399
400 if [ ! -z $ROBOT_LOCAL ] ; then
401 LOCAL_MOUNT_1="/robot-systest/lib"
402 LOCAL_MOUNT_2="/robot-systest/resources"
403 LOCAL_MOUNT_3="/robot-systest/testsuite"
404 else
405 LOCAL_MOUNT_1="/tmp/lib"
406 LOCAL_MOUNT_2="/tmp/resources"
407 LOCAL_MOUNT_3="/tmp/testsuite"
408 fi
409
410 mkdir -p reports
411
412 docker run -ti --entrypoint /bin/bash \
413 --env OSM_HOSTNAME=${OSM_HOSTNAME} \
414 --env PROMETHEUS_HOSTNAME=${PROMETHEUS_HOSTNAME} \
415 --env PROMETHEUS_PORT=${PROMETHEUS_PORT} \
416 --env JUJU_PASSWORD=${JUJU_PASSWORD} \
417 --env HOSTIP=${HOSTIP} \
418 --env-file robot-systest.cfg \
419 -v "$(pwd)/robot.etc.hosts":/etc/hosts \
420 -v ~/.osm/microk8s-config.yaml:/root/.kube/config \
421 -v "$(pwd)/clouds.yaml":/etc/openstack/clouds.yaml \
veleza05f3d9e2021-11-22 11:26:50 +0000422 -v "${HOME}/snap/qhttp/common"/robot-systest/reports \
423 -v "${HOME}/snap/qhttp/common:"/robot-systest/conformance-tests/reports \
beierlm85dc2392021-04-14 13:51:53 -0400424 -v "${ROOTDIR}/tests/robot-systest/lib":${LOCAL_MOUNT_1} \
425 -v "${ROOTDIR}/tests/robot-systest/resources":${LOCAL_MOUNT_2} \
426 -v "${ROOTDIR}/tests/robot-systest/testsuite":${LOCAL_MOUNT_3} \
David Garciaf0014df2021-06-16 10:37:34 +0200427 opensourcemano/tests:$OSM_TESTS_IMAGE_TAG
beierlm85dc2392021-04-14 13:51:53 -0400428}
429
430function update_osm_module() {
431 MODULES=$(_find_module_dockerfile $1)
432 for MODULE in ${MODULES} ; do
433 MODULE=${MODULE,,}
434 echo "Updating ${MODULE}"
435 juju attach-resource ${MODULE} image=localhost:32000/opensourcemano/${MODULE}:devel
436 done
437}
438
439if [ "$0" != "$BASH_SOURCE" ]; then
440
441 _osm_local_build()
442 {
443 OPTIONS=$(show_help | sed '0,/^OPTIONS:$/d' | awk '{print $1}')
444 COMPREPLY=($(compgen -W "${OPTIONS}" -- "${COMP_WORDS[-1]}"))
445 }
446
447 THIS_SCRIPT="$(basename ${BASH_SOURCE[0]})"
448 echo "Setting up bash completion for ${THIS_SCRIPT}"
449 complete -F _osm_local_build "${THIS_SCRIPT}"
450else
451 check_arguments $@
452
garciadeblas2c5b33f2023-04-13 11:00:14 +0200453 create_httpddir
beierlm85dc2392021-04-14 13:51:53 -0400454 eval "${INSTALL_HTTPD}"
455 eval "${INSTALL_LOCAL_REGISTRY}"
456 eval "${INSTALL_MICROSTACK}"
457 eval "${STAGE_2}"
458 eval "${STAGE_3}"
459 eval "${REGISTRY_PUSH}"
460 eval "${INSTALL_OSM}"
461 eval "${UPDATE_INSTALL}"
462 eval "${START_ROBOT}"
463fi