Skip to content
This repository was archived by the owner on Jun 13, 2025. It is now read-only.

Commit 38d2647

Browse files
committed
Store v2 reports in GCS instead of Redis
Worker has some dedicated code to move an uploaded report from Redis over to GCS. Instead of having that code, we can just store the report into GCS in the first place. Additionally, this PR also cleans up the `services.archive`, replacing it fully with the `shared.api_archive.archive`. It also forwards all the task arguments directly to the `Upload` task, in addition to storing it in Redis, to be forward compatible to some more planned upload processing improvements.
1 parent ffcc446 commit 38d2647

32 files changed

+132
-340
lines changed

graphql_api/dataloader/bundle_analysis.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from typing import Union
22

3+
from shared.api_archive.archive import ArchiveService
34
from shared.bundle_analysis import (
45
BundleAnalysisReportLoader,
56
MissingBaseReportError,
@@ -10,7 +11,6 @@
1011
from core.models import Commit
1112
from graphql_api.types.comparison.comparison import MissingBaseReport, MissingHeadReport
1213
from reports.models import CommitReport
13-
from services.archive import ArchiveService
1414
from services.bundle_analysis import BundleAnalysisComparison, BundleAnalysisReport
1515

1616

graphql_api/tests/test_bundle_analysis_measurements.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from unittest.mock import patch
22

33
from django.test import TransactionTestCase
4+
from shared.api_archive.archive import ArchiveService
45
from shared.bundle_analysis import StoragePaths
56
from shared.bundle_analysis.storage import get_bucket_name
67
from shared.django_apps.core.tests.factories import (
@@ -11,10 +12,7 @@
1112
from shared.storage.memory import MemoryStorageService
1213

1314
from reports.models import CommitReport
14-
from reports.tests.factories import (
15-
CommitReportFactory,
16-
)
17-
from services.archive import ArchiveService
15+
from reports.tests.factories import CommitReportFactory
1816
from timeseries.tests.factories import MeasurementFactory
1917

2018
from .helper import GraphQLTestHelper

graphql_api/tests/test_commit.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
import yaml
88
from django.test import TransactionTestCase
9+
from shared.api_archive.archive import ArchiveService
910
from shared.bundle_analysis import StoragePaths
1011
from shared.bundle_analysis.storage import get_bucket_name
1112
from shared.django_apps.core.tests.factories import (
@@ -30,7 +31,6 @@
3031
UploadFactory,
3132
UploadFlagMembershipFactory,
3233
)
33-
from services.archive import ArchiveService
3434
from services.comparison import MissingComparisonReport
3535
from services.components import Component
3636
from services.profiling import CriticalFile

graphql_api/tests/test_pull.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
from django.test import TransactionTestCase
66
from freezegun import freeze_time
7+
from shared.api_archive.archive import ArchiveService
78
from shared.bundle_analysis import StoragePaths
89
from shared.bundle_analysis.storage import get_bucket_name
910
from shared.django_apps.core.tests.factories import (
@@ -18,7 +19,6 @@
1819
from core.models import Commit
1920
from reports.models import CommitReport
2021
from reports.tests.factories import CommitReportFactory, ReportLevelTotalsFactory
21-
from services.archive import ArchiveService
2222

2323
from .helper import GraphQLTestHelper, paginate_connection
2424

profiling/serializers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from rest_framework import serializers
2+
from shared.api_archive.archive import ArchiveService
23

34
from profiling.models import ProfilingCommit, ProfilingUpload
4-
from services.archive import ArchiveService
55

66

77
class CreatableProfilingCommitRelatedField(serializers.SlugRelatedField):

profiling/tests/test_views.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,20 @@
22

33
from django.urls import reverse
44
from rest_framework.test import APIClient
5+
from shared.api_archive.archive import ArchiveService
56
from shared.django_apps.core.tests.factories import (
67
RepositoryFactory,
78
RepositoryTokenFactory,
89
)
910

1011
from profiling.models import ProfilingCommit, ProfilingUpload
11-
from services.archive import ArchiveService
1212
from services.task import TaskService
1313

1414

1515
def test_simple_profiling_apicall(db, mocker):
1616
mocked_call = mocker.patch.object(TaskService, "normalize_profiling_upload")
1717
mocker.patch(
18-
"services.archive.StorageService.create_presigned_put",
18+
"shared.api_archive.archive.StorageService.create_presigned_put",
1919
return_value="banana.txt",
2020
)
2121
repo = RepositoryFactory.create(active=True)

profiling/views.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33

44
from rest_framework.generics import CreateAPIView
55
from rest_framework.permissions import BasePermission
6+
from shared.api_archive.archive import ArchiveService, MinioEndpoints
67

78
from codecov_auth.authentication.repo_auth import RepositoryTokenAuthentication
89
from profiling.models import ProfilingCommit
910
from profiling.serializers import ProfilingCommitSerializer, ProfilingUploadSerializer
10-
from services.archive import ArchiveService, MinioEndpoints
1111
from services.task import TaskService
1212

1313
log = logging.getLogger(__name__)

requirements.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ factory-boy
2020
fakeredis
2121
freezegun
2222
https://github.com/codecov/opentelem-python/archive/refs/tags/v0.0.4a1.tar.gz#egg=codecovopentelem
23-
https://github.com/codecov/shared/archive/ebafd805394f22b4ab9e1f6e9a864ab28396dfe4.tar.gz#egg=shared
23+
https://github.com/codecov/shared/archive/ce68890c789aa1bc187438e71db13de2d0110d1c.tar.gz#egg=shared
2424
google-cloud-pubsub
2525
gunicorn>=22.0.0
2626
https://github.com/photocrowd/django-cursor-pagination/archive/f560902696b0c8509e4d95c10ba0d62700181d84.tar.gz

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ sentry-sdk[celery]==2.13.0
419419
# shared
420420
setproctitle==1.1.10
421421
# via -r requirements.in
422-
shared @ https://github.com/codecov/shared/archive/ebafd805394f22b4ab9e1f6e9a864ab28396dfe4.tar.gz
422+
shared @ https://github.com/codecov/shared/archive/ce68890c789aa1bc187438e71db13de2d0110d1c.tar.gz
423423
# via -r requirements.in
424424
simplejson==3.17.2
425425
# via -r requirements.in

services/archive.py

Lines changed: 0 additions & 125 deletions
This file was deleted.

0 commit comments

Comments
 (0)