| David Garcia | ef349d9 | 2020-12-10 21:16:12 +0100 | [diff] [blame] | 1 | #!/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. |
| 15 | set -eux |
| 16 | |
| 17 | channel=edge |
| 18 | tag=testing-daily |
| 19 | |
| 20 | # 1. Build charms |
| 21 | ./build.sh |
| 22 | |
| David Garcia | ef349d9 | 2020-12-10 21:16:12 +0100 | [diff] [blame] | 23 | |
| David Garcia | ef349d9 | 2020-12-10 21:16:12 +0100 | [diff] [blame] | 24 | # New charms (with resources) |
| David Garcia | 49379ce | 2021-02-24 13:48:22 +0100 | [diff] [blame] | 25 | charms="ng-ui nbi pla keystone ro lcm mon pol" |
| David Garcia | ef349d9 | 2020-12-10 21:16:12 +0100 | [diff] [blame] | 26 | for charm in $charms; do |
| 27 | echo "Releasing $charm charm" |
| 28 | cs_revision=$(charm push $charm/$charm.charm cs:~charmed-osm/$charm | tail -n +1 | head -1 | awk '{print $2}') |
| 29 | resource_revision=$(charm attach $cs_revision image=external::opensourcemano/$charm:$tag | tail -n +1 | sed 's/[^0-9]*//g') |
| 30 | image_revision_num=$(echo $resource_revision | awk '{print $NF}') |
| 31 | resources_string="--resource image-$image_revision_num" |
| 32 | charm release --channel $channel $cs_revision $resources_string |
| 33 | echo "$charm charm released!" |
| 34 | done |
| David Garcia | 49379ce | 2021-02-24 13:48:22 +0100 | [diff] [blame] | 35 | |
| David Garcia | 27bfcfd | 2021-05-19 18:04:31 +0200 | [diff] [blame] | 36 | charms="mongodb-exporter kafka-exporter mysqld-exporter" |
| 37 | for charm in $charms; do |
| 38 | echo "Releasing $charm charm" |
| 39 | cs_revision=$(charm push $charm/$charm.charm cs:~charmed-osm/$charm | tail -n +1 | head -1 | awk '{print $2}') |
| 40 | resource_revision=$(charm attach $cs_revision image=external::bitnami/$charm:latest | tail -n +1 | sed 's/[^0-9]*//g') |
| 41 | image_revision_num=$(echo $resource_revision | awk '{print $NF}') |
| 42 | resources_string="--resource image-$image_revision_num" |
| 43 | charm release --channel $channel $cs_revision $resources_string |
| 44 | echo "$charm charm released!" |
| 45 | done |
| 46 | |
| David Garcia | 2326429 | 2021-05-05 19:09:18 +0200 | [diff] [blame] | 47 | charm="prometheus" |
| 48 | echo "Releasing $charm charm" |
| 49 | cs_revision=$(charm push $charm/$charm.charm cs:~charmed-osm/$charm | tail -n +1 | head -1 | awk '{print $2}') |
| 50 | resource_revision=$(charm attach $cs_revision image=external::ubuntu/$charm:latest | tail -n +1 | sed 's/[^0-9]*//g') |
| 51 | image_revision_num=$(echo $resource_revision | awk '{print $NF}') |
| 52 | backup_resource_revision=$(charm attach $cs_revision backup-image=external::ed1000/prometheus-backup:latest | tail -n +1 | sed 's/[^0-9]*//g') |
| 53 | backup_image_revision_num=$(echo $backup_resource_revision | awk '{print $NF}') |
| 54 | resources_string="--resource image-$image_revision_num --resource backup-image-$backup_image_revision_num" |
| 55 | charm release --channel $channel $cs_revision $resources_string |
| 56 | echo "$charm charm released!" |
| 57 | |
| 58 | |
| 59 | charm="grafana" |
| 60 | echo "Releasing $charm charm" |
| 61 | cs_revision=$(charm push $charm/$charm.charm cs:~charmed-osm/$charm | tail -n +1 | head -1 | awk '{print $2}') |
| 62 | resource_revision=$(charm attach $cs_revision image=external::ubuntu/$charm:latest | tail -n +1 | sed 's/[^0-9]*//g') |
| 63 | image_revision_num=$(echo $resource_revision | awk '{print $NF}') |
| 64 | resources_string="--resource image-$image_revision_num" |
| 65 | charm release --channel $channel $cs_revision $resources_string |
| 66 | echo "$charm charm released!" |
| David Garcia | 49379ce | 2021-02-24 13:48:22 +0100 | [diff] [blame] | 67 | |
| David Garcia | de440ed | 2021-10-11 19:56:53 +0200 | [diff] [blame] | 68 | |
| 69 | charm="zookeeper" |
| 70 | echo "Releasing $charm charm" |
| 71 | cs_revision=$(charm push $charm/$charm.charm cs:~charmed-osm/$charm | tail -n +1 | head -1 | awk '{print $2}') |
| 72 | resource_revision=$(charm attach $cs_revision image=external::rocks.canonical.com:443/k8s.gcr.io/kubernetes-zookeeper:1.0-3.4.10 | tail -n +1 | sed 's/[^0-9]*//g') |
| 73 | image_revision_num=$(echo $resource_revision | awk '{print $NF}') |
| 74 | resources_string="--resource image-$image_revision_num" |
| 75 | charm release --channel $channel $cs_revision $resources_string |
| 76 | echo "$charm charm released!" |
| 77 | |
| 78 | |
| 79 | charm="kafka" |
| 80 | echo "Releasing $charm charm" |
| 81 | cs_revision=$(charm push $charm/$charm.charm cs:~charmed-osm/$charm | tail -n +1 | head -1 | awk '{print $2}') |
| 82 | resource_revision=$(charm attach $cs_revision image=external::rocks.canonical.com:443/wurstmeister/kafka:2.12-2.2.1 | tail -n +1 | sed 's/[^0-9]*//g') |
| 83 | image_revision_num=$(echo $resource_revision | awk '{print $NF}') |
| 84 | resources_string="--resource image-$image_revision_num" |
| 85 | charm release --channel $channel $cs_revision $resources_string |
| 86 | echo "$charm charm released!" |
| 87 | |
| 88 | |
| David Garcia | 49379ce | 2021-02-24 13:48:22 +0100 | [diff] [blame] | 89 | # 3. Grant permissions |
| David Garcia | de440ed | 2021-10-11 19:56:53 +0200 | [diff] [blame] | 90 | all_charms="ng-ui nbi pla keystone ro lcm mon pol grafana prometheus mongodb-exporter kafka-exporter mysqld-exporter zookeeper kafka" |
| David Garcia | 49379ce | 2021-02-24 13:48:22 +0100 | [diff] [blame] | 91 | for charm in $all_charms; do |
| 92 | echo "Granting permission for $charm charm" |
| 93 | charm grant cs:~charmed-osm/$charm --channel $channel --acl read everyone |
| David Garcia | de440ed | 2021-10-11 19:56:53 +0200 | [diff] [blame] | 94 | done |