Skip to content
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

Add a project-level configuration for PR builds #7090

Merged
merged 8 commits into from
May 26, 2020
Merged
7 changes: 5 additions & 2 deletions docs/guides/autobuild-docs-for-pull-requests.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@ Autobuild Documentation for Pull Requests
=========================================

Read the Docs allows autobuilding documentation for pull/merge requests for GitHub or GitLab projects.
This feature is currently available under a :doc:`Feature Flag </guides/feature-flags>`.
So, you can enable this feature by sending us an `email <mailto:support@readthedocs.org>`__ including your project URL.
This feature is currently enabled for a subset of our projects while being rolled out.
You can check to see if your project has it enabled by looking at the :guilabel:`Admin > Advanced settings` and look for :guilabel:`Build pull requests for this project`.
We are rolling this feature out based on the projects age on Read the Docs,
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
We are rolling this feature out based on the projects age on Read the Docs,
We are rolling this feature out based on the projects' age on Read the Docs,

I always confuse this, so maybe I'm wrong here :)

so older projects will get it first.
You can also ask for this feature by sending us an `email <mailto:support@readthedocs.org>`__ including your project URL.

Features
--------
Expand Down
5 changes: 5 additions & 0 deletions readthedocs/projects/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ class Meta:
'analytics_code',
'show_version_warning',
'single_version',
'external_builds_enabled'
)
# These that can be set per-version using a config file.
per_version_settings = (
Expand Down Expand Up @@ -259,6 +260,10 @@ def __init__(self, *args, **kwargs):
else:
self.fields['default_version'].widget.attrs['readonly'] = True

# Enable PR builder option on projects w/ feature flag
if not self.instance.has_feature(Feature.EXTERNAL_VERSION_BUILD):
self.fields.pop('external_builds_enabled')

def clean_conf_py_file(self):
filename = self.cleaned_data.get('conf_py_file', '').strip()
if filename and 'conf.py' not in filename:
Expand Down
18 changes: 18 additions & 0 deletions readthedocs/projects/migrations/0049_add_external_build_enabled.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 2.2.10 on 2020-05-18 20:17

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('projects', '0048_remove_version_privacy_field'),
]

operations = [
migrations.AddField(
model_name='project',
name='external_builds_enabled',
field=models.BooleanField(default=False, help_text='More information in <a href="https://docs.readthedocs.io/en/latest/guides/autobuild-docs-for-pull-requests.html">our docs</a>', verbose_name='Build pull requests for this project'),
),
]
6 changes: 6 additions & 0 deletions readthedocs/projects/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,12 @@ class Project(models.Model):
),
)

external_builds_enabled = models.BooleanField(
_('Build pull requests for this project'),
default=False,
help_text=_('More information in <a href="https://docs.readthedocs.io/en/latest/guides/autobuild-docs-for-pull-requests.html">our docs</a>') # noqa
)
ericholscher marked this conversation as resolved.
Show resolved Hide resolved

# Project features
cdn_enabled = models.BooleanField(_('CDN Enabled'), default=False)
analytics_code = models.CharField(
Expand Down