|
3 | 3 | # Exit immediately if a command exits with a non-zero status. |
4 | 4 | set -e |
5 | 5 |
|
6 | | -function usage { |
7 | | - echo "Usage: ${0} <project_id> [<token>]" |
8 | | - exit 1 |
9 | | -} |
| 6 | +PROJECT_ID="${GCLOUD_PROJECT}" |
| 7 | +TIMESTAMP=$(date +%s) |
10 | 8 |
|
11 | | -# This script takes in one required argument specifying a project_id and an |
12 | | -# optional arguement for a CI token that can be obtained by running |
13 | | -# `firebase login:ci` |
14 | | -# Example usage (from root dir) without token: |
15 | | -# ./integration_test/run_tests.sh chenky-test-proj |
16 | | -# Example usage (from root dir) with token: |
17 | | -# ./integration_test/run_tests.sh chenky-test-proj $TOKEN |
18 | | -if [[ "${1}" == "" ]]; then |
19 | | - usage |
| 9 | +if [[ "${PROJECT_ID}" == "" ]]; then |
| 10 | + echo "process.env.GCLOUD_PROJECT cannot be empty" |
| 11 | + exit 1 |
20 | 12 | fi |
21 | 13 |
|
22 | | -PROJECT_ID="${1}" |
23 | | -TIMESTAMP=$(date +%s) |
24 | | -TOKEN="${2}" |
25 | | - |
26 | 14 | # Directory where this script lives. |
27 | 15 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" |
28 | 16 |
|
@@ -64,22 +52,14 @@ function delete_all_functions { |
64 | 52 | cd "${DIR}" |
65 | 53 | # Try to delete, if there are errors it is because the project is already empty, |
66 | 54 | # in that case do nothing. |
67 | | - if [[ "${TOKEN}" == "" ]]; then |
68 | | - firebase functions:delete integrationTests v1 v2 --force --project=$PROJECT_ID || : & |
69 | | - else |
70 | | - firebase functions:delete integrationTests v1 v2 --force --project=$PROJECT_ID --token=$TOKEN || : & |
71 | | - fi |
| 55 | + firebase functions:delete integrationTests v1 v2 --force --project=$PROJECT_ID || : & |
72 | 56 | wait |
73 | 57 | announce "Project emptied." |
74 | 58 | } |
75 | 59 |
|
76 | 60 | function deploy { |
77 | 61 | # Deploy functions, and security rules for database and Firestore. If the deploy fails, retry twice |
78 | | - if [[ "${TOKEN}" == "" ]]; then |
79 | | - for i in 1 2 3; do firebase deploy --project="${PROJECT_ID}" --only functions,database,firestore && break; done |
80 | | - else |
81 | | - for i in 1 2 3; do firebase deploy --project="${PROJECT_ID}" --token="${TOKEN}" --only functions,database,firestore && break; done |
82 | | - fi |
| 62 | + for i in 1 2; do firebase deploy --project="${PROJECT_ID}" --only functions,database,firestore && break; done |
83 | 63 | } |
84 | 64 |
|
85 | 65 | function run_tests { |
|
0 commit comments