Skip to content

Commit

Permalink
cloud: Add storage_bucket to cloud functions env
Browse files Browse the repository at this point in the history
  • Loading branch information
octonawish-akcodes committed Jul 25, 2023
1 parent 528df29 commit 9294143
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
11 changes: 8 additions & 3 deletions cloud
Original file line number Diff line number Diff line change
Expand Up @@ -1323,6 +1323,7 @@ function cloud_functions_env() {
smtp_to_addrs smtp_password_secret \
smtp_topic smtp_subscription \
pgpass_secret \
cache_bucket_name \
database \
clean_test_databases \
empty_test_databases \
Expand Down Expand Up @@ -1353,6 +1354,9 @@ function cloud_functions_env() {
if [ -n "$extra_cc" ]; then
env[KCIDB_EXTRA_CC]="$extra_cc"
fi
if [ -n "$cache_bucket_name" ]; then
env[KCIDB_CACHE_BUCKET_NAME]="$cache_bucket_name"
fi
if [ -n "$smtp_to_addrs" ]; then
env[KCIDB_SMTP_TO_ADDRS]="$smtp_to_addrs"
fi
Expand Down Expand Up @@ -1764,7 +1768,7 @@ function execute_command() {
eval "declare -a argv=($argv)"

declare -r load_queue_trigger_topic="${prefix}load_queue_trigger"
declare -r storage_bucket="${project}_${prefix}cache"
declare -r cache_bucket_name="${project}_${prefix}cache"
declare -r pick_notifications_trigger_topic="${prefix}pick_notifications_trigger"
declare -r updated_urls_topic="${prefix}updated_urls"
declare -r new_topic="${prefix}new"
Expand Down Expand Up @@ -1891,6 +1895,7 @@ function execute_command() {

declare -r -a env_args=(
--log-level="$log_level"
--cache-bucket-name="$cache_bucket_name"
--optimize="$optimize"
--heavy-asserts="$heavy_asserts"
--new-topic="$new_topic"
Expand Down Expand Up @@ -1953,7 +1958,7 @@ function execute_command() {
--smtp-topic="$smtp_topic" \
--smtp-subscription="$smtp_subscription"
sections_run "$sections" firestore_deploy "$project"
sections_run "$sections" storage_deploy "$project" "$storage_bucket"
sections_run "$sections" storage_deploy "$project" "$cache_bucket_name"
sections_run "$sections" cloud_functions_deploy \
--project="$project" \
--prefix="$prefix" \
Expand Down Expand Up @@ -1985,7 +1990,7 @@ function execute_command() {
"$project" "$new_topic" "${submitters[@]}"
sections_run "$sections" scheduler_withdraw "$project" "$prefix"
sections_run "$sections" cloud_functions_withdraw "$project" "$prefix"
sections_run "$sections" storage_withdraw "$storage_bucket"
sections_run "$sections" storage_withdraw "$cache_bucket_name"
sections_run "$sections" firestore_withdraw \
"$project" "$spool_collection_path"
sections_run "$sections" pubsub_withdraw \
Expand Down
4 changes: 3 additions & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@
# The publisher object for the queue with patterns matching objects updated by
# loading submissions.
_UPDATED_QUEUE_PUBLISHER = None
# KCIDB cache storage bucket name
CACHE_BUCKET_NAME = os.environ.get("KCIDB_CACHE_BUCKET_NAME")


def get_smtp_publisher():
Expand Down Expand Up @@ -356,7 +358,7 @@ def get_cache_client():
global _CACHE_CLIENT
if _CACHE_CLIENT is None:
_CACHE_CLIENT = kcidb.cache.Client(
"cache_file_storage", 5 * 1024 * 1024
CACHE_BUCKET_NAME, 5 * 1024 * 1024
)
return _CACHE_CLIENT

Expand Down

0 comments on commit 9294143

Please sign in to comment.