blob: 6e8a40c0a9e170aa83008dadfd59d969c0238440 [file] [log] [blame]
David Garciaef349d92020-12-10 21:16:12 +01001#!/bin/bash
2# Copyright 2020 Canonical Ltd.
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15set -eux
16
17channel=edge
18tag=testing-daily
19
20# 1. Build charms
21./build.sh
22
23# 2. Release charms
24# Reactive charms
25charms="lcm-k8s mon-k8s pol-k8s ro-k8s"
David Garciaef349d92020-12-10 21:16:12 +010026for charm in $charms; do
27 cs_revision=`charm push $charm/release cs:~charmed-osm/$charm | tail -n +1 | head -1 | awk '{print $2}'`
28 charm release --channel $channel $cs_revision
29 echo "$charm charm released!"
30done
31
David Garciaef349d92020-12-10 21:16:12 +010032# New charms (with resources)
David Garcia49379ce2021-02-24 13:48:22 +010033charms="ng-ui nbi pla keystone ro lcm mon pol"
David Garciaef349d92020-12-10 21:16:12 +010034for charm in $charms; do
35 echo "Releasing $charm charm"
36 cs_revision=$(charm push $charm/$charm.charm cs:~charmed-osm/$charm | tail -n +1 | head -1 | awk '{print $2}')
37 resource_revision=$(charm attach $cs_revision image=external::opensourcemano/$charm:$tag | tail -n +1 | sed 's/[^0-9]*//g')
38 image_revision_num=$(echo $resource_revision | awk '{print $NF}')
39 resources_string="--resource image-$image_revision_num"
40 charm release --channel $channel $cs_revision $resources_string
41 echo "$charm charm released!"
42done
David Garcia49379ce2021-02-24 13:48:22 +010043
David Garcia23264292021-05-05 19:09:18 +020044charm="prometheus"
45echo "Releasing $charm charm"
46cs_revision=$(charm push $charm/$charm.charm cs:~charmed-osm/$charm | tail -n +1 | head -1 | awk '{print $2}')
47resource_revision=$(charm attach $cs_revision image=external::ubuntu/$charm:latest | tail -n +1 | sed 's/[^0-9]*//g')
48image_revision_num=$(echo $resource_revision | awk '{print $NF}')
49backup_resource_revision=$(charm attach $cs_revision backup-image=external::ed1000/prometheus-backup:latest | tail -n +1 | sed 's/[^0-9]*//g')
50backup_image_revision_num=$(echo $backup_resource_revision | awk '{print $NF}')
51resources_string="--resource image-$image_revision_num --resource backup-image-$backup_image_revision_num"
52charm release --channel $channel $cs_revision $resources_string
53echo "$charm charm released!"
54
55
56charm="grafana"
57echo "Releasing $charm charm"
58cs_revision=$(charm push $charm/$charm.charm cs:~charmed-osm/$charm | tail -n +1 | head -1 | awk '{print $2}')
59resource_revision=$(charm attach $cs_revision image=external::ubuntu/$charm:latest | tail -n +1 | sed 's/[^0-9]*//g')
60image_revision_num=$(echo $resource_revision | awk '{print $NF}')
61resources_string="--resource image-$image_revision_num"
62charm release --channel $channel $cs_revision $resources_string
63echo "$charm charm released!"
David Garcia49379ce2021-02-24 13:48:22 +010064
65# 3. Grant permissions
66all_charms="ng-ui nbi pla keystone ro lcm mon pol grafana prometheus"
67for charm in $all_charms; do
68 echo "Granting permission for $charm charm"
69 charm grant cs:~charmed-osm/$charm --channel $channel --acl read everyone
70done