Skip to content

Commit 83ab64f

Browse files
authored
Storage: remove build environment storage (#12077)
We are not using this storage backend anymore, we should delete the buckets as well.
1 parent 77758cd commit 83ab64f

File tree

4 files changed

+15
-44
lines changed

4 files changed

+15
-44
lines changed

readthedocs/settings/base.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -422,9 +422,6 @@ def MIDDLEWARE(self):
422422
# Django Storage subclass used to write build artifacts to cloud or local storage
423423
# https://docs.readthedocs.io/page/development/settings.html#rtd-build-media-storage
424424
RTD_BUILD_MEDIA_STORAGE = "readthedocs.builds.storage.BuildMediaFileSystemStorage"
425-
RTD_BUILD_ENVIRONMENT_STORAGE = (
426-
"readthedocs.builds.storage.BuildMediaFileSystemStorage"
427-
)
428425
RTD_BUILD_TOOLS_STORAGE = "readthedocs.builds.storage.BuildMediaFileSystemStorage"
429426
RTD_BUILD_COMMANDS_STORAGE = (
430427
"readthedocs.builds.storage.BuildMediaFileSystemStorage"

readthedocs/settings/docker_compose.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -177,10 +177,6 @@ def DATABASES(self): # noqa
177177
EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend"
178178

179179
RTD_BUILD_MEDIA_STORAGE = "readthedocs.storage.s3_storage.S3BuildMediaStorage"
180-
# Storage backend for build cached environments
181-
RTD_BUILD_ENVIRONMENT_STORAGE = (
182-
"readthedocs.storage.s3_storage.S3BuildEnvironmentStorage"
183-
)
184180
# Storage backend for build languages
185181
RTD_BUILD_TOOLS_STORAGE = "readthedocs.storage.s3_storage.S3BuildToolsStorage"
186182
# Storage for static files (those collected with `collectstatic`)
@@ -191,7 +187,6 @@ def DATABASES(self): # noqa
191187
AWS_SECRET_ACCESS_KEY = "password"
192188
S3_MEDIA_STORAGE_BUCKET = "media"
193189
S3_BUILD_COMMANDS_STORAGE_BUCKET = "builds"
194-
S3_BUILD_ENVIRONMENT_STORAGE_BUCKET = "envs"
195190
S3_BUILD_TOOLS_STORAGE_BUCKET = "build-tools"
196191
S3_STATIC_STORAGE_BUCKET = "static"
197192
S3_STATIC_STORAGE_OVERRIDE_HOSTNAME = PRODUCTION_DOMAIN

readthedocs/storage/__init__.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,6 @@ def _setup(self):
1616
self._wrapped = get_storage_class(settings.RTD_BUILD_MEDIA_STORAGE)()
1717

1818

19-
class ConfiguredBuildEnvironmentStorage(LazyObject):
20-
def _setup(self):
21-
self._wrapped = get_storage_class(settings.RTD_BUILD_ENVIRONMENT_STORAGE)()
22-
23-
2419
class ConfiguredBuildCommandsStorage(LazyObject):
2520
def _setup(self):
2621
self._wrapped = get_storage_class(settings.RTD_BUILD_COMMANDS_STORAGE)()
@@ -37,7 +32,6 @@ def _setup(self):
3732

3833

3934
build_media_storage = ConfiguredBuildMediaStorage()
40-
build_environment_storage = ConfiguredBuildEnvironmentStorage()
4135
build_commands_storage = ConfiguredBuildCommandsStorage()
4236
build_tools_storage = ConfiguredBuildToolsStorage()
4337
staticfiles_storage = ConfiguredStaticStorage()

readthedocs/storage/s3_storage.py

Lines changed: 15 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,20 @@
2323
from .mixins import S3PrivateBucketMixin
2424

2525

26-
class S3BuildMediaStorageMixin(BuildMediaStorageMixin, S3Boto3Storage):
26+
class S3BuildMediaStorage(OverrideHostnameMixin, BuildMediaStorageMixin, S3Boto3Storage):
27+
"""An AWS S3 Storage backend for build artifacts."""
28+
29+
bucket_name = getattr(settings, "S3_MEDIA_STORAGE_BUCKET", None)
30+
override_hostname = getattr(settings, "S3_MEDIA_STORAGE_OVERRIDE_HOSTNAME", None)
31+
32+
def __init__(self, *args, **kwargs):
33+
super().__init__(*args, **kwargs)
34+
35+
if not self.bucket_name:
36+
raise ImproperlyConfigured(
37+
"AWS S3 not configured correctly. Ensure S3_MEDIA_STORAGE_BUCKET is defined.",
38+
)
39+
2740
@cached_property
2841
def _rclone(self):
2942
provider = settings.S3_PROVIDER
@@ -39,21 +52,6 @@ def _rclone(self):
3952
)
4053

4154

42-
class S3BuildMediaStorage(OverrideHostnameMixin, S3BuildMediaStorageMixin):
43-
"""An AWS S3 Storage backend for build artifacts."""
44-
45-
bucket_name = getattr(settings, "S3_MEDIA_STORAGE_BUCKET", None)
46-
override_hostname = getattr(settings, "S3_MEDIA_STORAGE_OVERRIDE_HOSTNAME", None)
47-
48-
def __init__(self, *args, **kwargs):
49-
super().__init__(*args, **kwargs)
50-
51-
if not self.bucket_name:
52-
raise ImproperlyConfigured(
53-
"AWS S3 not configured correctly. Ensure S3_MEDIA_STORAGE_BUCKET is defined.",
54-
)
55-
56-
5755
class S3BuildCommandsStorage(S3PrivateBucketMixin, S3Boto3Storage):
5856
"""An AWS S3 Storage backend for build commands."""
5957

@@ -110,20 +108,7 @@ class NoManifestS3StaticStorage(S3StaticStorageMixin, OverrideHostnameMixin, S3B
110108
internal_redirect_root_path = "proxito-static"
111109

112110

113-
class S3BuildEnvironmentStorage(S3PrivateBucketMixin, S3BuildMediaStorageMixin):
114-
bucket_name = getattr(settings, "S3_BUILD_ENVIRONMENT_STORAGE_BUCKET", None)
115-
116-
def __init__(self, *args, **kwargs):
117-
super().__init__(*args, **kwargs)
118-
119-
if not self.bucket_name:
120-
raise ImproperlyConfigured(
121-
"AWS S3 not configured correctly. "
122-
"Ensure S3_BUILD_ENVIRONMENT_STORAGE_BUCKET is defined.",
123-
)
124-
125-
126-
class S3BuildToolsStorage(S3PrivateBucketMixin, S3BuildMediaStorageMixin):
111+
class S3BuildToolsStorage(S3PrivateBucketMixin, S3Boto3Storage):
127112
bucket_name = getattr(settings, "S3_BUILD_TOOLS_STORAGE_BUCKET", None)
128113

129114
def __init__(self, *args, **kwargs):

0 commit comments

Comments
 (0)