Skip to content

Commit 4e0b7be

Browse files
chore(launchpad): Return artifact URL upon creation
1 parent 6ff0fb7 commit 4e0b7be

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
from sentry.models.orgauthtoken import is_org_auth_token_auth, update_org_auth_token_last_used
1515
from sentry.preprod.analytics import PreprodArtifactApiAssembleEvent
1616
from sentry.preprod.tasks import assemble_preprod_artifact, create_preprod_artifact
17+
from sentry.preprod.url_utils import get_preprod_artifact_url
1718
from sentry.tasks.assemble import ChunkFileState
1819
from sentry.types.ratelimit import RateLimit, RateLimitCategory
1920

@@ -183,6 +184,12 @@ def post(self, request: Request, project) -> Response:
183184
if is_org_auth_token_auth(request.auth):
184185
update_org_auth_token_last_used(request.auth, [project.id])
185186

187+
artifact_url = get_preprod_artifact_url(project.organization_id, artifact_id)
188+
186189
return Response(
187-
{"state": ChunkFileState.OK, "missingChunks": [], "artifactId": artifact_id}
190+
{
191+
"state": ChunkFileState.OK,
192+
"missingChunks": [],
193+
"artifact_url": artifact_url,
194+
}
188195
)

src/sentry/preprod/url_utils.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
from __future__ import annotations
2+
3+
from sentry.models.organization import Organization
4+
5+
6+
def get_preprod_artifact_url(organization_id: int, artifact_id: int) -> str:
7+
"""
8+
Build a region/customer-domain aware absolute URL for the preprod artifact UI.
9+
"""
10+
organization: Organization = Organization.objects.get_from_cache(id=organization_id)
11+
12+
path = f"/organizations/{organization.slug}/preprod/internal/{artifact_id}"
13+
return organization.absolute_url(path)

0 commit comments

Comments
 (0)