Skip to content

Commit 01e648c

Browse files
authored
Remove legacy ReleaseBundle code (#90166)
We have had some code previously for the older version of `ArtifactBundle` (named `ReleaseBundle`), which was being used for a legacy upload endpoint, but was changed over to create `ArtifactBundle`s instead via a feature flag. That feature flag was hardcoded to always use the newer `ArtifactBundle` codepath over a year ago. But the legacy `ReleaseBundle` codepath has never been cleaned up. Until today 🎉
1 parent 4f49bdf commit 01e648c

10 files changed

+74
-449
lines changed

src/sentry/api/endpoints/organization_artifactbundle_assemble.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,6 @@ def post(self, request: Request, organization) -> Response:
163163
"dist": dist,
164164
"checksum": checksum,
165165
"chunks": chunks,
166-
"upload_as_artifact_bundle": True,
167166
}
168167
)
169168

src/sentry/api/endpoints/organization_release_assemble.py

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -63,20 +63,12 @@ def post(self, request: Request, organization, version) -> Response:
6363
checksum = data.get("checksum", None)
6464
chunks = data.get("chunks", [])
6565

66-
upload_as_artifact_bundle = True
67-
is_release_bundle_migration = True
6866
# NOTE: this list of projects can be further refined based on the
6967
# `project` embedded in the bundle manifest.
7068
project_ids = [project.id for project in release.projects.all()]
7169
metrics.incr("sourcemaps.upload.release_as_artifact_bundle")
7270

73-
assemble_task = (
74-
AssembleTask.ARTIFACT_BUNDLE
75-
if upload_as_artifact_bundle
76-
else AssembleTask.RELEASE_BUNDLE
77-
)
78-
79-
state, detail = get_assemble_status(assemble_task, organization.id, checksum)
71+
state, detail = get_assemble_status(AssembleTask.ARTIFACT_BUNDLE, organization.id, checksum)
8072
if state == ChunkFileState.OK:
8173
return Response({"state": state, "detail": None, "missingChunks": []}, status=200)
8274
elif state is not None:
@@ -88,7 +80,9 @@ def post(self, request: Request, organization, version) -> Response:
8880
if not chunks:
8981
return Response({"state": ChunkFileState.NOT_FOUND, "missingChunks": []}, status=200)
9082

91-
set_assemble_status(assemble_task, organization.id, checksum, ChunkFileState.CREATED)
83+
set_assemble_status(
84+
AssembleTask.ARTIFACT_BUNDLE, organization.id, checksum, ChunkFileState.CREATED
85+
)
9286

9387
from sentry.tasks.assemble import assemble_artifacts
9488

@@ -101,8 +95,7 @@ def post(self, request: Request, organization, version) -> Response:
10195
# NOTE: The `dist` is embedded in the Bundle manifest and optional here.
10296
# It will be backfilled from the manifest within the `assemble_artifacts` task.
10397
"project_ids": project_ids,
104-
"upload_as_artifact_bundle": upload_as_artifact_bundle,
105-
"is_release_bundle_migration": is_release_bundle_migration,
98+
"is_release_bundle_migration": True,
10699
}
107100
)
108101

src/sentry/api/endpoints/project_release_files.py

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,22 @@ def post_releasefile(request, release, logger):
125125
{"detail": "File name must not contain special whitespace characters"}, status=400
126126
)
127127

128+
headers = {"Content-Type": fileobj.content_type}
129+
for headerval in request.data.getlist("header") or ():
130+
try:
131+
k, v = headerval.split(":", 1)
132+
except ValueError:
133+
return Response({"detail": "header value was not formatted correctly"}, status=400)
134+
else:
135+
if _filename_re.search(v):
136+
return Response(
137+
{"detail": "header value must not contain special whitespace characters"},
138+
status=400,
139+
)
140+
headers[k] = v.strip()
141+
128142
dist_name = request.data.get("dist")
143+
129144
dist = None
130145
if dist_name:
131146
dist = release.add_dist(dist_name)
@@ -140,20 +155,6 @@ def post_releasefile(request, release, logger):
140155
).exists():
141156
return Response({"detail": ERR_FILE_EXISTS}, status=409)
142157

143-
headers = {"Content-Type": fileobj.content_type}
144-
for headerval in request.data.getlist("header") or ():
145-
try:
146-
k, v = headerval.split(":", 1)
147-
except ValueError:
148-
return Response({"detail": "header value was not formatted correctly"}, status=400)
149-
else:
150-
if _filename_re.search(v):
151-
return Response(
152-
{"detail": "header value must not contain special whitespace characters"},
153-
status=400,
154-
)
155-
headers[k] = v.strip()
156-
157158
file = File.objects.create(name=name, type="release.file", headers=headers)
158159
file.putfile(fileobj, logger=logger)
159160

0 commit comments

Comments
 (0)