Skip to content

Commit

Permalink
Feature flag: remove EXTERNAL_BUILD (#8050)
Browse files Browse the repository at this point in the history
This is already the default in both sites.
We already migrated projects to use the project setting.
  • Loading branch information
stsewd committed Mar 25, 2021
1 parent 1505061 commit b86e6f7
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 76 deletions.
2 changes: 0 additions & 2 deletions docs/guides/feature-flags.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ e.g. python-reno release notes manager is known to do that

``USE_TESTING_BUILD_IMAGE``: :featureflags:`USE_TESTING_BUILD_IMAGE`

``EXTERNAL_VERSION_BUILD``: :featureflags:`EXTERNAL_VERSION_BUILD`

``LIST_PACKAGES_INSTALLED_ENV``: :featureflags:`LIST_PACKAGES_INSTALLED_ENV`

``DONT_CREATE_INDEX``: :featureflags:`DONT_CREATE_INDEX`
Expand Down
13 changes: 2 additions & 11 deletions readthedocs/api/v2/views/integrations.py
Original file line number Diff line number Diff line change
Expand Up @@ -409,12 +409,7 @@ def handle_webhook(self):
return self.sync_versions_response(self.project)

# Handle pull request events
if all([
self.project.has_feature(Feature.EXTERNAL_VERSION_BUILD),
self.project.external_builds_enabled,
event == GITHUB_PULL_REQUEST,
action,
]):
if self.project.external_builds_enabled and event == GITHUB_PULL_REQUEST:
if (
action in
[
Expand Down Expand Up @@ -569,11 +564,7 @@ def handle_webhook(self):
except KeyError:
raise ParseError('Parameter "ref" is required')

if (
self.project.has_feature(Feature.EXTERNAL_VERSION_BUILD) and
self.project.external_builds_enabled and
event == GITLAB_MERGE_REQUEST and action
):
if self.project.external_builds_enabled and event == GITLAB_MERGE_REQUEST:
if (
action in
[
Expand Down
4 changes: 0 additions & 4 deletions readthedocs/projects/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,10 +273,6 @@ 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
5 changes: 0 additions & 5 deletions readthedocs/projects/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1569,7 +1569,6 @@ def add_features(sender, **kwargs):
DONT_SHALLOW_CLONE = 'dont_shallow_clone'
USE_TESTING_BUILD_IMAGE = 'use_testing_build_image'
CLEAN_AFTER_BUILD = 'clean_after_build'
EXTERNAL_VERSION_BUILD = 'external_version_build'
UPDATE_CONDA_STARTUP = 'update_conda_startup'
CONDA_APPEND_CORE_REQUIREMENTS = 'conda_append_core_requirements'
CONDA_USES_MAMBA = 'conda_uses_mamba'
Expand Down Expand Up @@ -1634,10 +1633,6 @@ def add_features(sender, **kwargs):
CLEAN_AFTER_BUILD,
_('Clean all files used in the build process'),
),
(
EXTERNAL_VERSION_BUILD,
_('Enable project to build on pull/merge requests'),
),
(
UPDATE_CONDA_STARTUP,
_('Upgrade conda before creating the environment'),
Expand Down
54 changes: 0 additions & 54 deletions readthedocs/rtd_tests/tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -901,11 +901,6 @@ def setUp(self):
build_queue=None,
external_builds_enabled=True,
)
self.feature_flag = get(
Feature,
projects=[self.project],
feature_id=Feature.EXTERNAL_VERSION_BUILD,
)
self.version = get(
Version, slug='master', verbose_name='master',
active=True, project=self.project,
Expand Down Expand Up @@ -1302,30 +1297,6 @@ def test_github_pull_request_closed_event_invalid_payload(self, trigger_build):

self.assertEqual(resp.status_code, 400)

@mock.patch('readthedocs.core.utils.trigger_build')
def test_github_pull_request_event_no_feature_flag(self, trigger_build, core_trigger_build):
# delete feature flag
self.feature_flag.delete()

client = APIClient()

headers = {GITHUB_EVENT_HEADER: GITHUB_PULL_REQUEST}
resp = client.post(
'/api/v2/webhook/github/{}/'.format(self.project.slug),
self.github_pull_request_payload,
format='json',
**headers
)
# get external version
external_version = self.project.versions(
manager=EXTERNAL
).filter(verbose_name='2').first()

self.assertEqual(resp.status_code, 200)
self.assertEqual(resp.data['detail'], 'Unhandled webhook event')
core_trigger_build.assert_not_called()
self.assertFalse(external_version)

@mock.patch('readthedocs.core.views.hooks.sync_repository_task')
def test_github_delete_event(self, sync_repository_task, trigger_build):
client = APIClient()
Expand Down Expand Up @@ -2066,31 +2037,6 @@ def test_gitlab_merge_request_close_event_invalid_payload(self, trigger_build):

self.assertEqual(resp.status_code, 400)

@mock.patch('readthedocs.core.utils.trigger_build')
def test_gitlab_merge_request_event_no_feature_flag(self, trigger_build, core_trigger_build):
# delete feature flag
self.feature_flag.delete()

client = APIClient()

resp = client.post(
reverse(
'api_webhook_gitlab',
kwargs={'project_slug': self.project.slug}
),
self.gitlab_merge_request_payload,
format='json',
)
# get external version
external_version = self.project.versions(
manager=EXTERNAL
).filter(verbose_name='2').first()

self.assertEqual(resp.status_code, 200)
self.assertEqual(resp.data['detail'], 'Unhandled webhook event')
core_trigger_build.assert_not_called()
self.assertFalse(external_version)

def test_bitbucket_webhook(self, trigger_build):
"""Bitbucket webhook API."""
client = APIClient()
Expand Down

0 comments on commit b86e6f7

Please sign in to comment.