-
-
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?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -178,6 +178,7 @@ def create_preprod_artifact( | |
| checksum: str, | ||
| build_configuration_name: str | None = None, | ||
| release_notes: str | None = None, | ||
| date_built: str | None = None, | ||
| head_sha: str | None = None, | ||
| base_sha: str | None = None, | ||
| provider: str | None = None, | ||
|
|
@@ -236,14 +237,30 @@ def create_preprod_artifact( | |
| if release_notes: | ||
| extras = {"release_notes": release_notes} | ||
|
|
||
| preprod_artifact, _ = PreprodArtifact.objects.get_or_create( | ||
| # Parse date_built if provided | ||
| parsed_date_built = None | ||
| if date_built: | ||
| try: | ||
| parsed_date_built = datetime.datetime.fromisoformat(date_built) | ||
| except (ValueError, TypeError) as e: | ||
| logger.warning( | ||
| "Failed to parse date_built", | ||
| extra={"date_built": date_built, "error": str(e)}, | ||
| ) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: Invalid date_built strings silently ignored after validationThe schema accepts any string for Additional Locations (1) |
||
|
|
||
| preprod_artifact, created = PreprodArtifact.objects.get_or_create( | ||
| project=project, | ||
| build_configuration=build_config, | ||
| state=PreprodArtifact.ArtifactState.UPLOADING, | ||
| commit_comparison=commit_comparison, | ||
| extras=extras, | ||
| ) | ||
|
|
||
| # 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"]) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: date_built not updated for existing artifactsThe |
||
|
|
||
| # TODO(preprod): add gating to only create if has quota | ||
| PreprodArtifactSizeMetrics.objects.get_or_create( | ||
| preprod_artifact=preprod_artifact, | ||
|
|
||
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.