b4611eef02e72b48e66e3d587e655cd1821ba081
[yaml_builds.git] / tools / deploy_site.sh
1 #!/bin/bash
2 ##############################################################################
3 # Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.        #
4 #                                                                            #
5 # Licensed under the Apache License, Version 2.0 (the "License"); you may    #
6 # not use this file except in compliance with the License.                   #
7 #                                                                            #
8 # You may obtain a copy of the License at                                    #
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, WITHOUT  #
13 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.           #
14 # See the License for the specific language governing permissions and        #
15 # limitations under the License.                                             #
16 ##############################################################################
17
18
19 set -x
20 TIMESTAMP=$(date +"%Y%m%d%H%M")
21 LOGFILE=/var/log/deploy_site_$TIMESTAMP.log
22 echo "logging to $LOGFILE"
23 exec 1> >(tee -a $LOGFILE)
24 exec 2>&1
25
26 # Site specific variables
27 export OS_AUTH_URL=
28 export OS_USERNAME=shipyard
29 export OS_PASSWORD=
30 REGION_NAME=
31 MAAS_URL=
32 AIRFLOW_URL=
33
34 sleep 900
35
36 tools/airship shipyard create configdocs ${REGION_NAME} --directory=/target/configs/promenade
37
38 tools/airship shipyard commit configdocs
39
40 tools/airship shipyard create action deploy_site
41
42 tools/airship shipyard get actions
43
44 SHIPYARD_ACTION=$(tools/airship shipyard get actions | awk '/deploy_site/ {print $2};')
45 SHIPYARD_CLI="tools/airship shipyard describe $SHIPYARD_ACTION"
46
47 echo "## Airship deployment has been started..."
48 echo "##"
49 echo "## To monitor progress check:"
50 echo "## MaaS GUI    -> $MAAS_URL"
51 echo "## Shipyard cli-> $SHIPYARD_CLI"
52 #echo "## Airflow GUI -> $AIRFLOW_URL"
53
54 while ( ! $SHIPYARD_CLI | grep -qe '^Lifecycle.*Complete' && ! $SHIPYARD_CLI | grep -qe '^step.*failed'); do
55   $SHIPYARD_CLI
56   echo "## Sleeping for 10 mins"
57   sleep 600
58 done
59 $SHIPYARD_CLI
60
61 exec 2>&-
62 exec 1>&-
63 $SHIPYARD_CLI | grep -qe '^step.*failed'