Skip to content

feat(preprod): Add preprod artifact upload endpoint #92528

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

NicoHinderling
Copy link

@NicoHinderling NicoHinderling commented May 29, 2025

Upload endpoint described in the emerge size integration proposal

Most of the logic is pretty similar to the debug file and sourcemap upload endpoints

in addition to the unit tests, I've manually tested uploading works via my test sentry-cli branch

@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label May 29, 2025
Copy link

codecov bot commented May 29, 2025

Codecov Report

Attention: Patch coverage is 98.37134% with 5 lines in your changes missing coverage. Please review.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...ndpoints/organization_preprod_artifact_assemble.py 90.00% 5 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##           master   #92528    +/-   ##
========================================
  Coverage   87.89%   87.89%            
========================================
  Files       10239    10241     +2     
  Lines      587377   587712   +335     
  Branches    22809    22809            
========================================
+ Hits       516275   516594   +319     
- Misses      70672    70688    +16     
  Partials      430      430            

"type": "array",
"items": {"type": "string", "pattern": "^[0-9a-f]{40}$"},
},
# Optional metadata
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this where we might need Git sha or other git info?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, after writing this doc, I think it's most likely that we'd just include the git info in the request body

@NicoHinderling NicoHinderling changed the title [wip] new preprod artifact upload endpoint feat(preprod): Add preprod artifact upload endpoint May 30, 2025
@NicoHinderling NicoHinderling marked this pull request as ready for review May 30, 2025 20:02
@NicoHinderling NicoHinderling requested review from a team as code owners May 30, 2025 20:02
Copy link
Member

@JoshFerge JoshFerge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did we end up creating a 'prepod' app folder? is there any reason why the endpoint and task can't live there instead of the catchall folders?

@NicoHinderling
Copy link
Author

did we end up creating a 'prepod' app folder? is there any reason why the endpoint and task can't live there instead of the catchall folders?

good catch, I can move the endpoint into it. The task file already existed though (just adding a method into it), so I'll plan to leave it as is assuming that's kosher 🙏

@JoshFerge
Copy link
Member

did we end up creating a 'prepod' app folder? is there any reason why the endpoint and task can't live there instead of the catchall folders?

good catch, I can move the endpoint into it. The task file already existed though (just adding a method into it), so I'll plan to leave it as is assuming that's kosher 🙏

ah yup that makes sense. thanks! also feel free to define your own urls file and import them into the main one like here:

from django.urls import re_path


@region_silo_endpoint
class ProjectPreprodArtifactAssembleEndpoint(ProjectEndpoint):
owner = ApiOwner.OWNERS_INGEST
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably be for our team.

"file_name": data.get("file_name"),
"sha": data.get("sha"),
"build_configuration": data.get("build_configuration"),
"extras": data.get("extras"),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extras shouldn't be part of the external API, these are more for our own internal use. We had a few use-cases in Emerge that were locked down to org42, but let's try to avoid that here if possible for as long as we can.

# 4. Update state to PROCESSED when done (also update the date_built value to reflect when the artifact was built, among other fields)

except Exception as e:
logger.exception("Failed to assemble preprod artifact")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you record the project/org?

"project_id": project.id,
"checksum": checksum,
"chunks": chunks,
"file_name": data.get("file_name"),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we removed filename in our API a while back, do you think the UUID is fine?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hah, it's still in our docs. yea I talked w hector about this and neither of us felt strongly. We can just auto-gen a file name and remove this param 👍

"checksum": checksum,
"chunks": chunks,
"file_name": data.get("file_name"),
"sha": data.get("sha"),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: since this assemble api is doing some checksum stuff, maybe this should be git_sha?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Scope: Backend Automatically applied to PRs that change backend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants