blob: f3ed497232d40ac7d68da4de99b94153d81eb90b [file] [log] [blame]
aguilard8c0a0542023-11-13 13:16:32 +00001#!/usr/bin/env 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
garciadeblasa4b669e2024-06-25 16:40:44 +020019ssh -T -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null ubuntu@"${OSM_IP_ADDRESS}" \
aguilard8c0a0542023-11-13 13:16:32 +000020'sudo apt-get update -y && sudo apt-get upgrade -y && sudo reboot'
21
22sleep 90
23
24# OSM installation
25INSTALLER_PARAMETERS="-R ${REPO_BASE} -t ${DOCKER_TAG} -r ${REPO_NAME} -y"
26echo "INSTALLER_URL: $INSTALLER_URL"
27echo "INSTALLER_PARAMETERS: $INSTALLER_PARAMETERS"
garciadeblasa4b669e2024-06-25 16:40:44 +020028ssh -T -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null ubuntu@${OSM_IP_ADDRESS} << EOF 2>&1
aguilard8c0a0542023-11-13 13:16:32 +000029set -eux
30wget "${INSTALLER_URL}"
31chmod +x install_osm.sh
32./install_osm.sh ${INSTALLER_PARAMETERS} 2>&1 | tee osm_install_log.txt
33set +eux
34EOF
35
36# # Installs additional tools for telemetry
37# set +eux
garciadeblasa4b669e2024-06-25 16:40:44 +020038# ssh -T -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null ubuntu@${OSM_IP_ADDRESS} 'sudo apt-get install -y sysstat'
aguilard8c0a0542023-11-13 13:16:32 +000039# set -eux
40
41# Gets Juju password from LCM env file
42set +eux
garciadeblasa4b669e2024-06-25 16:40:44 +020043JUJU_PWD=$(ssh -T -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null ubuntu@${OSM_IP_ADDRESS} 'kubectl -n osm exec -ti deploy/lcm -- env | grep OSMLCM_VCA_SECRET | cut -d = -f 2')
aguilard8c0a0542023-11-13 13:16:32 +000044set -eux
45
46# Updates environment variables and logs them
47export JUJU_PASSWORD="${JUJU_PWD}"
48
49# Logs new/updated environment variables
50cat <<EOF >> ${ROBOT_REPORT_FOLDER}/osm_environment.rc
51export JUJU_PASSWORD="${JUJU_PWD}"
52EOF
53
54echo Environment was updated at ${ROBOT_REPORT_FOLDER}/osm_environment.rc