Skip to content

Commit

Permalink
fix: set GCS_BUCKET_NAME in settings using config
Browse files Browse the repository at this point in the history
  • Loading branch information
joseph-sentry committed Dec 4, 2024
1 parent 7ab2b02 commit dacfc02
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion codecov/settings_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@
DATABASE_ROUTERS = ["codecov.db.DatabaseRouter"]

# GCS
GCS_BUCKET_NAME = "codecov"
GCS_BUCKET_NAME = get_config("services", "minio", "bucket", default="codecov")


# Password validation
Expand Down
2 changes: 1 addition & 1 deletion codecov/settings_staging.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
COOKIE_SAME_SITE = "None"
SESSION_COOKIE_SAMESITE = "None"

GCS_BUCKET_NAME = "codecov-staging"
GCS_BUCKET_NAME = get_config("services", "minio", "bucket", default="codecov-staging")

Check warning on line 75 in codecov/settings_staging.py

View check run for this annotation

Codecov Notifications / codecov/patch

codecov/settings_staging.py#L75

Added line #L75 was not covered by tests

CSRF_TRUSTED_ORIGINS = [
get_config("setup", "trusted_origin", default="https://*.codecov.dev")
Expand Down
8 changes: 4 additions & 4 deletions utils/test_results.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import polars as pl
from django.conf import settings
from shared.api_archive.storage import StorageService
from shared.storage.exceptions import FileNotInStorageError

from services.redis_configuration import get_redis_connection
from services.task import TaskService
from utils.config import get_config


def redis_key(
Expand Down Expand Up @@ -53,14 +53,14 @@ def get_results(
key = redis_key(repoid, branch, interval_start, interval_end)
result: bytes | None = redis_conn.get(key)

bucket_name: str = get_config("services", "minio", "bucket", default="archive") # type: ignore

if result is None:
# try storage
storage_service = StorageService()
key = storage_key(repoid, branch, interval_start, interval_end)
try:
result = storage_service.read_file(bucket_name=bucket_name, path=key)
result = storage_service.read_file(
bucket_name=settings.GCS_BUCKET_NAME, path=key
)
# cache to redis
TaskService().cache_test_results_redis(repoid, branch)
except FileNotInStorageError:
Expand Down

0 comments on commit dacfc02

Please sign in to comment.