Skip to content
This repository was archived by the owner on Jun 13, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ def test_update_bundles_successfully(self):
)

assert res == [
{"bundle_name": "bundle1", "is_cached": False},
{"bundle_name": "bundle2", "is_cached": True},
{"bundle_name": "bundle1", "is_cached": False, "cache_config": False},
{"bundle_name": "bundle2", "is_cached": True, "cache_config": True},
]

assert len(CacheConfig.objects.all()) == 2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ def execute(
{
"bundle_name": bundle_name,
"is_cached": is_caching,
"cache_config": is_caching,
}
)
return results
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
results {
bundleName
isCached
cacheConfig
}
error {
__typename
Expand Down
5 changes: 5 additions & 0 deletions graphql_api/tests/test_commit.py
Original file line number Diff line number Diff line change
Expand Up @@ -1202,6 +1202,7 @@ def test_bundle_analysis_report(self, get_storage_service):
}
}
isCached
cacheConfig
}
bundleData {
loadTime {
Expand Down Expand Up @@ -1263,6 +1264,7 @@ def test_bundle_analysis_report(self, get_storage_service):
},
},
"isCached": False,
"cacheConfig": False,
},
{
"name": "b2",
Expand All @@ -1285,6 +1287,7 @@ def test_bundle_analysis_report(self, get_storage_service):
},
},
"isCached": False,
"cacheConfig": False,
},
{
"name": "b3",
Expand All @@ -1307,6 +1310,7 @@ def test_bundle_analysis_report(self, get_storage_service):
},
},
"isCached": False,
"cacheConfig": False,
},
{
"name": "b5",
Expand All @@ -1329,6 +1333,7 @@ def test_bundle_analysis_report(self, get_storage_service):
},
},
"isCached": False,
"cacheConfig": False,
},
],
"bundleData": {
Expand Down
1 change: 1 addition & 0 deletions graphql_api/types/bundle_analysis/base.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ type BundleReport {
before: String
): AssetConnection
info: BundleReportInfo!
cacheConfig: Boolean!
}

type BundleAnalysisMeasurements{
Expand Down
7 changes: 7 additions & 0 deletions graphql_api/types/bundle_analysis/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,13 @@ def resolve_bundle_report_is_cached(
return bundle_report.is_cached


@bundle_report_bindable.field("cacheConfig")
def resolve_bundle_report_cache_config(
bundle_report: BundleReport, info: GraphQLResolveInfo
) -> bool:
return bundle_report.cache_config(info.context["commit"].repository.pk)


@bundle_report_bindable.field("info")
def resolve_bundle_report_info(
bundle_report: BundleReport, info: GraphQLResolveInfo
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ union UpdateBundleCacheConfigError = UnauthenticatedError | ValidationError
type UpdateBundleCacheConfigResult {
bundleName: String
isCached: Boolean
cacheConfig: Boolean
}

type UpdateBundleCacheConfigPayload {
Expand Down
2 changes: 1 addition & 1 deletion requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ freezegun
google-cloud-pubsub
gunicorn>=22.0.0
https://github.com/codecov/opentelem-python/archive/refs/tags/v0.0.4a1.tar.gz#egg=codecovopentelem
https://github.com/codecov/shared/archive/986a0971a633eac2a3005947102cb5f4d9119989.tar.gz#egg=shared
https://github.com/codecov/shared/archive/69b736859ab71e1e3e91018439a6cb6b792502f3.tar.gz#egg=shared
https://github.com/photocrowd/django-cursor-pagination/archive/f560902696b0c8509e4d95c10ba0d62700181d84.tar.gz
idna>=3.7
minio
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ sentry-sdk[celery]==2.13.0
# shared
setproctitle==1.1.10
# via -r requirements.in
shared @ https://github.com/codecov/shared/archive/986a0971a633eac2a3005947102cb5f4d9119989.tar.gz
shared @ https://github.com/codecov/shared/archive/69b736859ab71e1e3e91018439a6cb6b792502f3.tar.gz
# via -r requirements.in
simplejson==3.17.2
# via -r requirements.in
Expand Down
10 changes: 10 additions & 0 deletions services/bundle_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,12 @@
from shared.bundle_analysis import BundleReport as SharedBundleReport
from shared.bundle_analysis import ModuleReport as SharedModuleReport
from shared.bundle_analysis.models import AssetType
from shared.django_apps.bundle_analysis.service.bundle_analysis import (
BundleAnalysisCacheConfigService,
)
from shared.storage import get_appropriate_storage_service

from codecov.db import sync_to_async
from core.models import Commit, Repository
from graphql_api.actions.measurements import (
measurements_by_ids,
Expand Down Expand Up @@ -306,6 +310,12 @@ def is_cached(self) -> bool:
def info(self) -> dict:
return self.report.info()

@sync_to_async
def cache_config(self, repo_id: int) -> bool:
return BundleAnalysisCacheConfigService.get_cache_option(
repo_id=repo_id, name=self.report.name
)


@dataclass
class BundleReportInfo(object):
Expand Down
Loading