blob: fb697acf72690b19c4fb6fd9323b222e18a3f9e6 [file] [log] [blame]
garciadeblas90344b62024-08-20 16:28:12 +02001#!/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
garciadeblasd2272722024-09-11 14:35:35 +020019if [ $# -ne 2 ]; then
garciadeblas90344b62024-08-20 16:28:12 +020020 echo "Usage $0 <module> <tag_number>"
21 echo "Example: $0 ro 2"
22 echo "Example: $0 lcm 5"
23 exit 1
24fi
25
26MODULE_NAME="$1"
27TAG_NUMBER="$2"
28
29set -x
30IMAGE_NAME="opensourcemano/${MODULE_NAME}:devel-${TAG_NUMBER}"
31docker tag opensourcemano/${MODULE_NAME}:devel ${IMAGE_NAME}
32IMAGE_FILE="${MODULE_NAME}-devel-${TAG_NUMBER}.tar.gz"
33docker save -o ${IMAGE_FILE} ${IMAGE_NAME}
34sudo ctr -n=k8s.io images import ${IMAGE_FILE}
35rm ${IMAGE_FILE}
36sudo ctr -n=k8s.io images list |grep ${IMAGE_NAME}
37echo $IMAGE_NAME
38kubectl -n osm patch deployment ${MODULE_NAME} --patch '{"spec": {"template": {"spec": {"containers": [{"name": "'${MODULE_NAME}'", "image": "'${IMAGE_NAME}'"}]}}}}'
39kubectl -n osm rollout restart deployment ${MODULE_NAME}
40