-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
feat(preprod): Add date_built support to artifact assemble endpoint (EME-631) #104052
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
base: master
Are you sure you want to change the base?
Conversation
…EME-631) Add support for capturing build timestamps for Android artifacts via the assemble endpoint. This allows sentry-cli to pass date_built when uploading APK/AAB files, since Android artifacts don't contain reliable build timestamps (due to reproducible builds). Changes: - Add date_built to assemble endpoint schema validation - Parse ISO 8601 date strings to datetime objects - Store date_built in PreprodArtifact model (field already exists) - Add tests for schema validation and artifact creation
| "chunks": "The chunks field is required and must be provided as an array of 40-character hexadecimal strings.", | ||
| "build_configuration": "The build_configuration field must be a string.", | ||
| "release_notes": "The release_notes field msut be a string.", | ||
| "date_built": "The date_built field must be an ISO 8601 formatted date-time string.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I figured with ISO-8601 we can set and send the local time zone information from the gradle plugin.
| # Set date_built if provided and artifact was just created | ||
| if created and parsed_date_built: | ||
| preprod_artifact.date_built = parsed_date_built | ||
| preprod_artifact.save(update_fields=["date_built"]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: date_built not updated for existing artifacts
The date_built field is only set when a new artifact is created (created == True), but not when an existing artifact is retrieved by get_or_create. If the same artifact is uploaded multiple times (e.g., retries, CI reruns), subsequent uploads with a different or corrected date_built timestamp will silently ignore the new value, leaving the original timestamp unchanged. This breaks the intended functionality of capturing accurate build timestamps.
| logger.warning( | ||
| "Failed to parse date_built", | ||
| extra={"date_built": date_built, "error": str(e)}, | ||
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Invalid date_built strings silently ignored after validation
The schema accepts any string for date_built without validating ISO 8601 format. Invalid date strings like "invalid-date" pass schema validation but fail during datetime.fromisoformat() parsing, causing the error to be logged as a warning while the artifact is created successfully with date_built set to null. Users receive no error response indicating their timestamp was invalid and discarded, leading to silent data loss.
Additional Locations (1)
❌ 4 Tests Failed:
View the top 3 failed test(s) by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
Summary
Adds backend support for capturing build timestamps for Android artifacts via the assemble endpoint. This allows sentry-cli to pass
date_builtwhen uploading APK/AAB files.Unlike iOS, Android artifacts don't contain reliable build timestamps due to reproducible builds, so the timestamp must be captured at build time by the Gradle plugin and passed through sentry-cli. See discussion in EME-631 Android date_built
Changes
date_builtfield to assemble endpoint schema validationPreprodArtifact.date_builtfield (no migration needed)Related