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