-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Design doc: improvements and new features for automation rules #7653
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
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 |
---|---|---|
@@ -0,0 +1,101 @@ | ||
Automation Rules | ||
================ | ||
|
||
Automation rules allow users to apply some actions over new or deleted versions. | ||
See :doc:`/automation-rules` for more details of the current features. | ||
|
||
This document explore some ideas to expand automation rules to automate more tasks. | ||
|
||
Current state and limitations | ||
----------------------------- | ||
|
||
- Matches are done using regular expressions. | ||
But the models were designed so other type of matches can be implemented | ||
(like comparing the version with the highest semver version). | ||
- Automation rules are meant to automate existing actions, | ||
so an action shouldn't be able to be triggered only inside an automation rule. | ||
This is so users aren't blocked if a rule didn't match a version, | ||
or if they need to execute the action over existing versions. | ||
- Automation rules are currently matched against new versions, | ||
but they can also be executed over deleted versions (https://github.com/readthedocs/readthedocs.org/pull/7644). | ||
|
||
Improvements | ||
------------ | ||
|
||
Keep track of the ``n`` latest matches | ||
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. This is something that I've wanting for some time. I think it's super useful to keep track of what happened to understand why my versions have changed. Also, to debug mistakes on my own rules. |
||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
We do this with webhook exchanges (keeping the latest 10) | ||
https://github.com/readthedocs/readthedocs.org/blob/f5b76e87a3b970d42228f5972ae9a50364c3c76c/readthedocs/integrations/models.py#L99-L111. | ||
See https://github.com/readthedocs/readthedocs.org/issues/6393. | ||
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. It would be useful if we put all of these issues in a GH project to have an overview about how things are going. |
||
|
||
Live feedback of versions that match a rule | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
When creating/editing a rule, it would be useful to know what versions are going to match. | ||
We could list the current versions that match and/or allow the user to enter a custom input. | ||
A new enpoint in api v2/v3 should be added. | ||
|
||
Easy way to invert a match | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
Currently, users need to write a negative look ahead, | ||
which isn't really user-friendly or easy to remember/write. | ||
Having an explicit option to invert a match would be more useful, | ||
see https://github.com/readthedocs/readthedocs.org/issues/6354. | ||
|
||
New features | ||
------------ | ||
|
||
Change the privacy level of external versions | ||
stsewd marked this conversation as resolved.
Show resolved
Hide resolved
|
||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
In Read the Docs for business all versions are private by default. | ||
Some users may want to change the privacy level of external versions. | ||
See https://github.com/readthedocs/readthedocs-corporate/issues/1063. | ||
|
||
If automation rules are going to be used, users will need to be able to edit those versions. | ||
This means having a place to list all external versions and allow to edit some properties, | ||
privacy level is the only option that makes sense maybe also allow to de-activate it so docs aren't accessible. | ||
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. I'm not sure if it makes sense to "de-activate PR via automation rule". I think users can already disable this feature from the project admin. Is this different than the current disable option there? 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. Here the deactivating the version would delete the files from storage. Currently, we don't delete them. I think we may want to have this in .com, so the content isn't flying around 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. I don't follow here. When a PR is merged, we do delete everything for that external version, including builds. Can you elaborate what would be a good use case for the feature of "de-activating external versions via automated rules"? 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.
We only delete the build logs, the documentation is kept in storage. But we went with another solution for now #7678 |
||
|
||
Decide what PRs should be built | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
Use automation rules to decide which pull requests should be built, | ||
this is for example only built branches that are going to be merged against an specific branch. | ||
Or branch names that match a pattern, like (``^docs/.*``). | ||
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. This seems really useful 👍 |
||
|
||
.. note:: | ||
|
||
Here we don't need a separate UI element yet, | ||
as users can still trigger a new build by pushing to that branch if they got the pattern wrong. | ||
|
||
Change the slug a version served from | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
Currently, we create the version slug from the version name, and this can't be changed. | ||
Some users may end up with a slug they didn't intend, | ||
Or there are users that want their slug to be different from the name of the branch/tag, | ||
such as https://github.com/readthedocs/readthedocs.org/issues/7078. | ||
|
||
The models from automation rules already support passing enxtra arguments to be used by an action. | ||
Before implementing this rule, we need to allow adding an alias for versions manually, | ||
this would be by creating an alias (should the version be served from two slugs?) | ||
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. I think it would be good to find a way to automatically create redirects on slug changes, so we don't break old links. 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. yeah, that was pointed in the design doc of changing the slug https://github.com/readthedocs/readthedocs.org/pull/6273/files#diff-9561f5273ac1998bbd574fc850e2c100688ed8b291273f690fd49d6df45639beR80-R82 |
||
or by allowing to change the slug of the version (less code to change). | ||
See https://github.com/readthedocs/readthedocs.org/issues/5318, | ||
and https://github.com/readthedocs/readthedocs.org/pull/6273. | ||
|
||
Set a version as stable | ||
~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
Internally we create a version named ``stable`` pointing to the commit of the latest semver tag or branch, | ||
see https://github.com/readthedocs/readthedocs.org/blob/f5b76e87a3b970d42228f5972ae9a50364c3c76c/readthedocs/api/v2/views/model_views.py#L246-L246 | ||
Currently, users can create a version named stable to override this version. | ||
|
||
If we implement this rule, | ||
we need to implement a way to set a version as stable, | ||
maybe similar to the option ``default version`` (if empty we select stable based on latest semver version). | ||
This can also be done in a more general way using aliases, | ||
but we'll need to change the logic when syncing versions to not lose the slug (see above section). | ||
|
||
See https://github.com/readthedocs/readthedocs.org/issues/5319. |
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 wonder if a better way to improve this might be removing the above restriction (eg. UI must be able to do it) and allow users to run automation rules across all their existing versions. This seems like a useful improvement.
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.
A problem with that is if the user wants to change only one version or a couple, it needs to create a new rule with a pattern that only matches those versions, then run that rule against existing versions and delete it so new versions use a new rule.
We also need to think about how to place this element in the UI, but I guess that's the same amount of work (or maybe less) if we want to add a feature to enable it manually.
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.
"Apply an automation rule on existing versions", is that what we are taking about here? If so, isn't it very similar to "Live feedback of versions that match a rule" feature? I mean, it seems it's exactly the same code. We could have a checkbox saying "Apply this rule to existing versions" when creating the automation rule.
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.
yeah, but that has the problem that you'll need to write several rules and delete them just to match a couple of versions, instead of having the option of editing one by one, or in order to edit something you need to create a new rule. But I can see where that option could be useful too if you want to edit versions in bulk.