Skip to content

Commit 9ed4ed8

Browse files
authored
bug(preprod): Fix CommitComparison creation (#97956)
Passes the arguments to the correct function now when creating the artifact. I believe this got messed up with much of the recent churn when updating the assemble endpoint to no longer be a polling endpoint.
1 parent 3777e4c commit 9ed4ed8

File tree

3 files changed

+33
-33
lines changed

3 files changed

+33
-33
lines changed

src/sentry/preprod/api/endpoints/organization_preprod_artifact_assemble.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,14 @@ def post(self, request: Request, project: Project) -> Response:
147147
checksum=checksum,
148148
build_configuration=data.get("build_configuration"),
149149
release_notes=data.get("release_notes"),
150+
head_sha=data.get("head_sha"),
151+
base_sha=data.get("base_sha"),
152+
provider=data.get("provider"),
153+
head_repo_name=data.get("head_repo_name"),
154+
base_repo_name=data.get("base_repo_name"),
155+
head_ref=data.get("head_ref"),
156+
base_ref=data.get("base_ref"),
157+
pr_number=data.get("pr_number"),
150158
)
151159

152160
if artifact_id is None:
@@ -165,15 +173,6 @@ def post(self, request: Request, project: Project) -> Response:
165173
"chunks": chunks,
166174
"artifact_id": artifact_id,
167175
"build_configuration": data.get("build_configuration"),
168-
# VCS parameters
169-
"head_sha": data.get("head_sha"),
170-
"base_sha": data.get("base_sha"),
171-
"provider": data.get("provider"),
172-
"head_repo_name": data.get("head_repo_name"),
173-
"base_repo_name": data.get("base_repo_name"),
174-
"head_ref": data.get("head_ref"),
175-
"base_ref": data.get("base_ref"),
176-
"pr_number": data.get("pr_number"),
177176
}
178177
)
179178
if is_org_auth_token_auth(request.auth):

src/sentry/preprod/tasks.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -105,14 +105,7 @@ def assemble_preprod_artifact(
105105
project_id=project_id,
106106
organization_id=org_id,
107107
artifact_id=artifact_id,
108-
head_sha=kwargs.get("head_sha"),
109-
base_sha=kwargs.get("base_sha"),
110-
provider=kwargs.get("provider"),
111-
head_repo_name=kwargs.get("head_repo_name"),
112-
base_repo_name=kwargs.get("base_repo_name"),
113-
head_ref=kwargs.get("head_ref"),
114-
base_ref=kwargs.get("base_ref"),
115-
pr_number=kwargs.get("pr_number"),
108+
**kwargs,
116109
)
117110

118111
except Exception as e:

tests/sentry/preprod/api/endpoints/test_organization_preprod_artifact_assemble.py

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,14 @@ def test_assemble_basic(
373373
checksum=total_checksum,
374374
build_configuration=None,
375375
release_notes=None,
376+
head_sha=None,
377+
base_sha=None,
378+
provider=None,
379+
head_repo_name=None,
380+
base_repo_name=None,
381+
head_ref=None,
382+
base_ref=None,
383+
pr_number=None,
376384
)
377385

378386
mock_assemble_preprod_artifact.apply_async.assert_called_once_with(
@@ -383,14 +391,6 @@ def test_assemble_basic(
383391
"chunks": [blob.checksum],
384392
"artifact_id": artifact_id,
385393
"build_configuration": None,
386-
"head_sha": None,
387-
"base_sha": None,
388-
"provider": None,
389-
"head_repo_name": None,
390-
"base_repo_name": None,
391-
"head_ref": None,
392-
"base_ref": None,
393-
"pr_number": None,
394394
}
395395
)
396396

@@ -443,6 +443,14 @@ def test_assemble_with_metadata(
443443
checksum=total_checksum,
444444
build_configuration="release",
445445
release_notes=None,
446+
head_sha="e" * 40,
447+
base_sha="f" * 40,
448+
provider="github",
449+
head_repo_name="owner/repo",
450+
base_repo_name="owner/repo",
451+
head_ref="feature/xyz",
452+
base_ref="main",
453+
pr_number=123,
446454
)
447455

448456
mock_assemble_preprod_artifact.apply_async.assert_called_once_with(
@@ -453,14 +461,6 @@ def test_assemble_with_metadata(
453461
"chunks": [blob.checksum],
454462
"artifact_id": artifact_id,
455463
"build_configuration": "release",
456-
"head_sha": "e" * 40,
457-
"base_sha": "f" * 40,
458-
"provider": "github",
459-
"head_repo_name": "owner/repo",
460-
"base_repo_name": "owner/repo",
461-
"head_ref": "feature/xyz",
462-
"base_ref": "main",
463-
"pr_number": 123,
464464
}
465465
)
466466

@@ -729,4 +729,12 @@ def test_assemble_create_artifact_failure(
729729
checksum=total_checksum,
730730
build_configuration=None,
731731
release_notes=None,
732+
head_sha=None,
733+
base_sha=None,
734+
provider=None,
735+
head_repo_name=None,
736+
base_repo_name=None,
737+
head_ref=None,
738+
base_ref=None,
739+
pr_number=None,
732740
)

0 commit comments

Comments
 (0)