Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/bin/bash | 1 #!/bin/bash |
| 2 # | 2 # |
| 3 # Copyright 2015 The Chromium Authors. All rights reserved. | 3 # Copyright 2015 The Chromium Authors. All rights reserved. |
| 4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
| 6 # | 6 # |
| 7 # This script is to ease running Findit locally, running its unit tests, and | 7 # This script is to ease running Findit locally, running its unit tests, and |
| 8 # deploying Findit to App Engine. | 8 # deploying Findit to App Engine. |
| 9 | 9 |
| 10 THIS_SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE:-$0}" )" && pwd )" | 10 THIS_SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE:-$0}" )" && pwd )" |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 41 | 41 |
| 42 run_findit_locally() { | 42 run_findit_locally() { |
| 43 local options="--storage_path ${TMP_DIR}/findit" | 43 local options="--storage_path ${TMP_DIR}/findit" |
| 44 python ${GOOGLE_APP_ENGINE_DIR}/dev_appserver.py ${options} ${FINDIT_MODULES} | 44 python ${GOOGLE_APP_ENGINE_DIR}/dev_appserver.py ${options} ${FINDIT_MODULES} |
| 45 } | 45 } |
| 46 | 46 |
| 47 deploy_findit() { | 47 deploy_findit() { |
| 48 local app_id="findit-for-waterfall" | 48 local app_id="findit-for-waterfall" |
| 49 if [[ "$1" == "prod" ]]; then | 49 if [[ "$1" == "prod" ]]; then |
| 50 app_id="findit-for-me" | 50 app_id="findit-for-me" |
| 51 local update_log="$TMP_DIR/update.log" | |
| 52 echo "Syncing code to tip of tree, logging in $update_log ..." | |
| 53 local update="$(cd $INFRA_DIR && git pull >>$update_log 2>>$update_log && gc lient sync >>$update_log 2>>$update_log && echo $?)" | |
| 54 if [[ "$update" != "0" ]]; then | |
| 55 echo "Failed to run 'git pull && gclient sync'!" | |
| 56 echo "Please check log at $update_log" | |
| 57 return | |
| 58 fi | |
| 59 echo "Code was synced successfully." | |
|
qyearsley
2016/01/17 03:43:12
Are the changes in run.sh related to the other cha
chanli
2016/01/20 18:07:08
Sorry. There should be no change on run.sh...
| |
| 60 fi | 51 fi |
| 61 | 52 |
| 62 local current_version=`curl -s https://${app_id}.appspot.com/version` | 53 local current_version=`curl -s https://${app_id}.appspot.com/version` |
| 63 if ! [[ $current_version =~ ^[0-9a-fA-F]+$ ]]; then | 54 if ! [[ $current_version =~ ^[0-9a-fA-F]+$ ]]; then |
| 55 echo $current_version | |
| 64 echo "Failed to retrieve current version of Findit from the live app." | 56 echo "Failed to retrieve current version of Findit from the live app." |
| 65 echo "Please input the current version, followed by [ENTER]:" | 57 echo "Please input the current version, followed by [ENTER]:" |
| 66 read current_version | 58 read current_version |
| 59 echo | |
| 67 fi | 60 fi |
| 68 echo "Current deployed version is $current_version" | |
| 69 | 61 |
| 70 local new_version="$(git rev-parse --short HEAD)" | 62 local new_version="$(git rev-parse --short HEAD)" |
| 71 if [[ "$1" == "prod" ]]; then | |
| 72 # Check uncommitted local changes. | |
| 73 local changed_file_number="$(git status --porcelain | wc -l)" | |
| 74 if [[ "$changed_file_number" != "0" ]]; then | |
| 75 echo "You have uncommitted local changes!" | |
| 76 echo "Please run 'git status' to check local changes." | |
| 77 return | |
| 78 fi | |
| 79 | |
| 80 # Check committed local changes. | |
| 81 local tot_version="$(git rev-parse --short origin/master)" | |
| 82 if [[ "$new_version" != "$tot_version" ]]; then | |
| 83 echo "You have local commits!" | |
| 84 echo "Please run 'git reset $tot_version' to reset the local changes." | |
| 85 return | |
| 86 fi | |
| 87 fi | |
| 88 | |
| 89 local app_cfg="${GOOGLE_APP_ENGINE_DIR}/appcfg.py" | 63 local app_cfg="${GOOGLE_APP_ENGINE_DIR}/appcfg.py" |
| 90 | 64 |
| 91 echo "Current deployed version is '$current_version'." | 65 echo "Current deployed version is '$current_version'." |
| 92 echo "Deploying new version '${new_version}'..." | 66 echo "Deploying new version '${new_version}'..." |
| 93 | 67 |
| 94 echo | 68 echo |
| 95 echo "-----------------------------------" | 69 echo "-----------------------------------" |
| 96 python ${app_cfg} update -A ${app_id} $FINDIT_MODULES --version ${new_version} | 70 python ${app_cfg} update -A ${app_id} $FINDIT_MODULES --version ${new_version} |
| 97 echo "-----------------------------------" | 71 echo "-----------------------------------" |
| 98 echo | 72 echo |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 132 deploy-test) | 106 deploy-test) |
| 133 deploy_findit "test" | 107 deploy_findit "test" |
| 134 ;; | 108 ;; |
| 135 deploy-prod) | 109 deploy-prod) |
| 136 deploy_findit "prod" | 110 deploy_findit "prod" |
| 137 ;; | 111 ;; |
| 138 *) | 112 *) |
| 139 print_usage | 113 print_usage |
| 140 ;; | 114 ;; |
| 141 esac | 115 esac |
| OLD | NEW |