API v3: add build parity fields and cold-storage commands#12794
API v3: add build parity fields and cold-storage commands#12794ericholscher wants to merge 12 commits intomainfrom
Conversation
|
Pretty happy where this ended up. I almost went down the config rabbit hole but figured that would just make this PR even larger. |
…x/api-v3-build-fields-11179
|
Actually looks like the config rabbithole was just merged :) |
humitos
left a comment
There was a problem hiding this comment.
This is going in the correct direction, I'd say. We just need to refactor a little the fields structure of the URL fields to keep the pattern we already have in other serializers.
| if commands is not None: | ||
| data["commands"] = commands | ||
|
|
||
| return Response(data) |
There was a problem hiding this comment.
It seems we are changing the logic here when not settings.RTD_SAVE_BUILD_COMMANDS_TO_STORAGE.
The old code runs return super().retrieve(*args, **kwargs) and now we will be running return Response(serializer.data) instead.
Is that the same?
| self.build.config = {"property": "test value"} | ||
| self.build.save() |
There was a problem hiding this comment.
Why are we moving this outside the fixture.get? We should be able to put it there to avoid an extra DB call.
| docs_url = serializers.SerializerMethodField() | ||
| commit_url = serializers.SerializerMethodField() |
There was a problem hiding this comment.
These attributes should be inside the urls field. We have a specific serializer to add more of these: BuildURLsSerializer
There was a problem hiding this comment.
Also, we should use urls.documenation instead of urls.docs to keep consistency with the VersionURLsSerializer
| "id", | ||
| "build", | ||
| "command", | ||
| "description", | ||
| "output", | ||
| "exit_code", | ||
| "start_time", | ||
| "end_time", | ||
| "run_time", |
There was a problem hiding this comment.
We can probably remove these fields since we are not using them.
| "id", | |
| "build", | |
| "command", | |
| "description", | |
| "output", | |
| "exit_code", | |
| "start_time", | |
| "end_time", | |
| "run_time", | |
| "id", | |
| "command", | |
| "output", | |
| "exit_code", | |
| "start_time", | |
| "end_time", | |
| "run_time", |
Fixes #11179
This updates the build API v3 endpoint to unblock dashboard usage without API v2 fallbacks.
docs_url,commit_url,builder,commands)expand=configavailable on the build endpointreadthedocs.api.v2.utils.get_build_commands_from_storageand reuses it from both API v2 and API v3Validation run in this branch:
pytestinvocations are blocked by an existing local test DB/migration issue in this workspace (projects_addonsconfig.notifications_disable_prNOT NULL)Screenshot
Generated by Copilot.