Skip to content

Commit

Permalink
Remove superfluous select-environment.sh (#27)
Browse files Browse the repository at this point in the history
I went a little overboard with select-environment.sh, I realized it's
not actually necessary as long as we pass `--project $project_id` flags
to all `gcloud ` commands
  • Loading branch information
chapati23 authored Oct 1, 2024
1 parent 66be7f0 commit f00ac12
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 32 deletions.
3 changes: 2 additions & 1 deletion bin/deploy-via-gcloud.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ set -u # Treat unset variables as an error when substituting
deploy_via_gcloud() {
printf "\n"

# Load the current project variables
script_dir=$(dirname "$0")
source "${script_dir}/select-environment.sh" "$1"
source "${script_dir}/get-project-vars.sh"

# Deploy the Google Cloud Function
echo "Deploying to Google Cloud Functions..."
Expand Down
3 changes: 2 additions & 1 deletion bin/get-function-logs-url.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ set -u # Treat unset variables as an error when substituting
# Prints the log explorer URL for the Cloud Function and displays it in the terminal.
# Requires an environment arg (e.g., staging, production).
get_function_logs_url() {
# Load the current project variables
script_dir=$(dirname "$0")
source "${script_dir}/select-environment.sh" "$1"
source "${script_dir}/get-project-vars.sh"

# Get time 1 hour ago in UTC
start_time=$(date -u -v-1H +"%Y-%m-%dT%H:%M:%S.000Z")
Expand Down
4 changes: 3 additions & 1 deletion bin/get-function-logs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ set -u # Treat unset variables as an error when substituting
# Fetches the latest logs for the Cloud Function and displays them in the terminal.
# Requires an environment arg (e.g., staging, production).
get_function_logs() {
# Load the current project variables
script_dir=$(dirname "$0")
source "${script_dir}/select-environment.sh" "$1"
source "${script_dir}/get-project-vars.sh"

# Fetch raw logs
raw_logs=$(gcloud logging read "resource.labels.function_name=${function_name}" \
--project "${project_id}" \
--format json \
--limit 50)

Expand Down
29 changes: 0 additions & 29 deletions bin/select-environment.sh

This file was deleted.

0 comments on commit f00ac12

Please sign in to comment.