Skip to content

External versions: save state (open / closed) #9128

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

Merged
merged 4 commits into from
Apr 25, 2022

Conversation

humitos
Copy link
Member

@humitos humitos commented Apr 21, 2022

When an external Version is created, we mark it as .state="open" and when it's
closed/merged we mark is as .state="closed".

Note that we cannot use .active=False for this as we were doing, because we
want to keep serving closed/merged PRs during some extra time after they are
closed/merged and El Proxito is not serving inactive versions.

With this approach, external versions will be always .active=True but with
different .state=. That state is used by the periodic Celery task to know if
the version has to be deleted or not.

Closes #9109

@humitos humitos requested a review from ericholscher April 21, 2022 14:04
@humitos humitos force-pushed the humitos/external-versions-state branch 4 times, most recently from a7f10ff to 5c65f16 Compare April 21, 2022 14:33
When an external Version is created, we mark it as `.state="open"` and when it's
closed/merged we mark is as `.state="closed"`.

Note that we cannot use `.active=False` for this as we were doing, because we
want to keep serving closed/merged PRs during some extra time after they are
closed/merged and El Proxito is not serving inactive versions.

With this approach, external versions will be always `.active=True` but with
different `.state=`. That state is used by the periodic Celery task to know if
the version has to be deleted or not.

Closes #9109
@humitos humitos force-pushed the humitos/external-versions-state branch from 5c65f16 to 8bff524 Compare April 21, 2022 14:33

Return a JSON response with the following::

{
"version_deactivated": true,
"closed": true,
Copy link
Member Author

Choose a reason for hiding this comment

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

This is changing the API response. Do we have any concerns about this? In theory, nobody should be listen to this response, tho. We reply this to GitHub / GitLab.

Copy link
Member

Choose a reason for hiding this comment

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

Yea, should be fine.

@humitos humitos marked this pull request as ready for review April 21, 2022 14:34
@humitos humitos requested a review from a team as a code owner April 21, 2022 14:34
Copy link
Member

@stsewd stsewd left a comment

Choose a reason for hiding this comment

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

We need a data migration to change the state of the current inactive external versions to be closed and to mark them as active.

humitos and others added 2 commits April 21, 2022 18:17
Migrate inactive versions to `active` and `state=closed`.
Co-authored-by: Santos Gallegos <[email protected]>
@humitos humitos requested a review from stsewd April 21, 2022 16:19
Copy link
Member

@ericholscher ericholscher left a comment

Choose a reason for hiding this comment

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

This looks like a good approach. 👍 for getting it out next week -- I keep hitting old PR builds that don't work..


Return a JSON response with the following::

{
"version_deactivated": true,
"closed": true,
Copy link
Member

Choose a reason for hiding this comment

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

Yea, should be fine.

@@ -51,6 +51,12 @@
(EXTERNAL, EXTERNAL_TEXT),
(UNKNOWN, UNKNOWN_TEXT),
)
EXTERNAL_VERSION_STATE_OPEN = "open"
EXTERNAL_VERSION_STATE_CLOSED = "closed"
Copy link
Member

Choose a reason for hiding this comment

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

Do we want more granularity here? Merged vs Closed?

Copy link
Member Author

Choose a reason for hiding this comment

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

In the first commit, I used open, closed and merged, but I didn't find how/where we would use it differently, so I removed it because it just complicate the logic. Do you have a good usage for this in mind?

Copy link
Member

Choose a reason for hiding this comment

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

Mostly displaying the information in the build page, or docs pages. Not a huge deal though, seems fine to start with this.

@ericholscher ericholscher merged commit 9241a9e into main Apr 25, 2022
@ericholscher ericholscher deleted the humitos/external-versions-state branch April 25, 2022 21:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Old Pull Request previews are infinite redirecting
3 participants