Skip to content

Commit 5ad812e

Browse files
committed
Merge branch 'master' into unify-feature-check
2 parents 277a513 + c89ab93 commit 5ad812e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+1412
-536
lines changed

.circleci/config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ jobs:
4545
echo 'export PATH=~/.nvm/versions/node/v${NODE_VERSION}/bin:$PATH' >> $BASH_ENV
4646
source $BASH_ENV
4747
- run: tox -e migrations
48+
- run: tox -e pre-commit
4849
- run: tox -e lint
4950
- run: tox -e docs-lint
5051
- run: tox -e docs

.github/CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
* @readthedocs/backend
22

3-
docs/* @readthedocs/advocacy
3+
/docs/ @readthedocs/advocacy

.style.yapf

Lines changed: 0 additions & 1 deletion
This file was deleted.

CHANGELOG.rst

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,72 @@
1+
Version 7.4.1
2+
-------------
3+
4+
:Date: March 07, 2022
5+
6+
* `@humitos <https://github.com/humitos>`__: Upgrade common submodule (`#9001 <https://github.com/readthedocs/readthedocs.org/pull/9001>`__)
7+
* `@humitos <https://github.com/humitos>`__: Build: `RepositoryError` message (`#8999 <https://github.com/readthedocs/readthedocs.org/pull/8999>`__)
8+
* `@humitos <https://github.com/humitos>`__: Requirements: remove `django-permissions-policy` (`#8987 <https://github.com/readthedocs/readthedocs.org/pull/8987>`__)
9+
* `@stsewd <https://github.com/stsewd>`__: Archive builds: avoid filtering by commands__isnull (`#8986 <https://github.com/readthedocs/readthedocs.org/pull/8986>`__)
10+
* `@humitos <https://github.com/humitos>`__: Build: cancel error message (`#8984 <https://github.com/readthedocs/readthedocs.org/pull/8984>`__)
11+
* `@humitos <https://github.com/humitos>`__: API: validate `RemoteRepository` when creating a `Project` (`#8983 <https://github.com/readthedocs/readthedocs.org/pull/8983>`__)
12+
* `@humitos <https://github.com/humitos>`__: Celery: trigger `archive_builds` frequently with a lower limit (`#8981 <https://github.com/readthedocs/readthedocs.org/pull/8981>`__)
13+
* `@pyup-bot <https://github.com/pyup-bot>`__: pyup: Scheduled weekly dependency update for week 09 (`#8977 <https://github.com/readthedocs/readthedocs.org/pull/8977>`__)
14+
* `@stsewd <https://github.com/stsewd>`__: MkDocs: allow None on extra_css/extra_javascript (`#8976 <https://github.com/readthedocs/readthedocs.org/pull/8976>`__)
15+
* `@stsewd <https://github.com/stsewd>`__: CDN: avoid cache tags collision (`#8969 <https://github.com/readthedocs/readthedocs.org/pull/8969>`__)
16+
* `@stsewd <https://github.com/stsewd>`__: Docs: warn about custom domains on subprojects (`#8945 <https://github.com/readthedocs/readthedocs.org/pull/8945>`__)
17+
* `@humitos <https://github.com/humitos>`__: Code style: format the code using `darker` (`#8875 <https://github.com/readthedocs/readthedocs.org/pull/8875>`__)
18+
* `@dogukanteber <https://github.com/dogukanteber>`__: Use django-storages' manifest files class instead of the overriden class (`#8781 <https://github.com/readthedocs/readthedocs.org/pull/8781>`__)
19+
* `@nienn <https://github.com/nienn>`__: Docs: Add links to documentation on creating custom classes (`#8466 <https://github.com/readthedocs/readthedocs.org/pull/8466>`__)
20+
* `@stsewd <https://github.com/stsewd>`__: Integrations: allow to pass more data about external versions (`#7692 <https://github.com/readthedocs/readthedocs.org/pull/7692>`__)
21+
22+
Version 7.4.0
23+
-------------
24+
25+
:Date: March 01, 2022
26+
27+
* `@stsewd <https://github.com/stsewd>`__: Fix typo on exception (`#8975 <https://github.com/readthedocs/readthedocs.org/pull/8975>`__)
28+
* `@humitos <https://github.com/humitos>`__: Celery: increase timeout limit for `sync_remote_repositories` task (`#8974 <https://github.com/readthedocs/readthedocs.org/pull/8974>`__)
29+
* `@agjohnson <https://github.com/agjohnson>`__: Fix a couple integration admin bugs (`#8964 <https://github.com/readthedocs/readthedocs.org/pull/8964>`__)
30+
* `@humitos <https://github.com/humitos>`__: Build: allow NULL when updating the config (`#8962 <https://github.com/readthedocs/readthedocs.org/pull/8962>`__)
31+
* `@agjohnson <https://github.com/agjohnson>`__: Release 7.3.0 (`#8957 <https://github.com/readthedocs/readthedocs.org/pull/8957>`__)
32+
* `@pyup-bot <https://github.com/pyup-bot>`__: pyup: Scheduled weekly dependency update for week 08 (`#8954 <https://github.com/readthedocs/readthedocs.org/pull/8954>`__)
33+
* `@humitos <https://github.com/humitos>`__: Celery: upgrade to latest version (`#8952 <https://github.com/readthedocs/readthedocs.org/pull/8952>`__)
34+
* `@humitos <https://github.com/humitos>`__: Requirements: upgrade gitpython because of security issue (`#8950 <https://github.com/readthedocs/readthedocs.org/pull/8950>`__)
35+
* `@humitos <https://github.com/humitos>`__: Test: remove verbose warnings (`#8949 <https://github.com/readthedocs/readthedocs.org/pull/8949>`__)
36+
* `@agjohnson <https://github.com/agjohnson>`__: Pin storages with boto3 (`#8947 <https://github.com/readthedocs/readthedocs.org/pull/8947>`__)
37+
* `@stsewd <https://github.com/stsewd>`__: Optimize archive_builds task (`#8944 <https://github.com/readthedocs/readthedocs.org/pull/8944>`__)
38+
* `@humitos <https://github.com/humitos>`__: Build: reset build error before start building (`#8943 <https://github.com/readthedocs/readthedocs.org/pull/8943>`__)
39+
* `@humitos <https://github.com/humitos>`__: Build: comment `record=False` usage (`#8939 <https://github.com/readthedocs/readthedocs.org/pull/8939>`__)
40+
* `@humitos <https://github.com/humitos>`__: Django3: use new JSON fields instead of old TextFields (`#8934 <https://github.com/readthedocs/readthedocs.org/pull/8934>`__)
41+
* `@humitos <https://github.com/humitos>`__: Build: ability to cancel a running build from dashboard (`#8850 <https://github.com/readthedocs/readthedocs.org/pull/8850>`__)
42+
* `@humitos <https://github.com/humitos>`__: Celery: remove queue priority (`#8848 <https://github.com/readthedocs/readthedocs.org/pull/8848>`__)
43+
44+
Version 7.3.0
45+
-------------
46+
47+
:Date: February 21, 2022
48+
49+
* `@humitos <https://github.com/humitos>`__: Requirements: upgrade gitpython because of security issue (`#8950 <https://github.com/readthedocs/readthedocs.org/pull/8950>`__)
50+
* `@humitos <https://github.com/humitos>`__: Test: remove verbose warnings (`#8949 <https://github.com/readthedocs/readthedocs.org/pull/8949>`__)
51+
* `@agjohnson <https://github.com/agjohnson>`__: Pin storages with boto3 (`#8947 <https://github.com/readthedocs/readthedocs.org/pull/8947>`__)
52+
* `@stsewd <https://github.com/stsewd>`__: Fix codeowners (`#8946 <https://github.com/readthedocs/readthedocs.org/pull/8946>`__)
53+
* `@stsewd <https://github.com/stsewd>`__: Optimize archive_builds task (`#8944 <https://github.com/readthedocs/readthedocs.org/pull/8944>`__)
54+
* `@humitos <https://github.com/humitos>`__: Build: reset build error before start building (`#8943 <https://github.com/readthedocs/readthedocs.org/pull/8943>`__)
55+
* `@humitos <https://github.com/humitos>`__: Build: comment `record=False` usage (`#8939 <https://github.com/readthedocs/readthedocs.org/pull/8939>`__)
56+
* `@humitos <https://github.com/humitos>`__: Django3: use new JSON fields instead of old TextFields (`#8934 <https://github.com/readthedocs/readthedocs.org/pull/8934>`__)
57+
* `@agjohnson <https://github.com/agjohnson>`__: Tune build config migration (`#8931 <https://github.com/readthedocs/readthedocs.org/pull/8931>`__)
58+
* `@humitos <https://github.com/humitos>`__: Build: use `ubuntu-20.04` image for setup VCS step (`#8930 <https://github.com/readthedocs/readthedocs.org/pull/8930>`__)
59+
* `@humitos <https://github.com/humitos>`__: Celery: remove duplication of task names (`#8929 <https://github.com/readthedocs/readthedocs.org/pull/8929>`__)
60+
* `@humitos <https://github.com/humitos>`__: Sentry and Celery: do not log `RepositoryError` in Sentry (`#8928 <https://github.com/readthedocs/readthedocs.org/pull/8928>`__)
61+
* `@ericholscher <https://github.com/ericholscher>`__: Add x-hoverxref-version to CORS (`#8927 <https://github.com/readthedocs/readthedocs.org/pull/8927>`__)
62+
* `@humitos <https://github.com/humitos>`__: Deploy: avoid locking the table when adding new JSON field (`#8926 <https://github.com/readthedocs/readthedocs.org/pull/8926>`__)
63+
* `@humitos <https://github.com/humitos>`__: Build: access valid arguments (`#8925 <https://github.com/readthedocs/readthedocs.org/pull/8925>`__)
64+
* `@humitos <https://github.com/humitos>`__: Comment: add comment from PR review (`#8921 <https://github.com/readthedocs/readthedocs.org/pull/8921>`__)
65+
* `@stsewd <https://github.com/stsewd>`__: Move subscription tasks (`#8916 <https://github.com/readthedocs/readthedocs.org/pull/8916>`__)
66+
* `@pyup-bot <https://github.com/pyup-bot>`__: pyup: Scheduled weekly dependency update for week 07 (`#8915 <https://github.com/readthedocs/readthedocs.org/pull/8915>`__)
67+
* `@stsewd <https://github.com/stsewd>`__: Proxito: add top-level docs (`#8913 <https://github.com/readthedocs/readthedocs.org/pull/8913>`__)
68+
* `@humitos <https://github.com/humitos>`__: Celery: remove queue priority (`#8848 <https://github.com/readthedocs/readthedocs.org/pull/8848>`__)
69+
170
Version 7.2.1
271
-------------
372

docs/user/guides/adding-custom-css.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,3 +77,8 @@ you can include the theme's normal CSS using the CSS
7777
body {
7878
/* ... */
7979
}
80+
81+
82+
.. seealso::
83+
84+
You can also add custom classes to your html elements. See `Docutils Class <https://docutils.sourceforge.io/docs/ref/rst/directives.html#class>`_ and this related `Sphinx footnote... <https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html#id2>`_ for more information.

docs/user/subprojects.rst

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ The documentation for ``Bar`` will be available under this same path:
1515

1616
https://foo.readthedocs.io/projects/bar/en/latest/
1717

18-
Adding a Subproject
18+
Adding a subproject
1919
-------------------
2020

2121
In the admin dashboard for your project, select "Subprojects" from the menu.
@@ -24,9 +24,9 @@ From this page you can add a subproject by typing in the project slug.
2424
Subproject aliases
2525
~~~~~~~~~~~~~~~~~~
2626

27-
You can use an alias for the subproject when it is created. This allows you to override the URL that is used to access it, giving more configurability to how you want to structure your projects.
27+
You can use an alias for the subproject when it is created. This allows you to override the URL that is used to access it, giving more configurability to how you want to structure your projects.
2828

29-
Sharing a Custom Domain
29+
Sharing a custom domain
3030
-----------------------
3131

3232
Projects and subprojects can also be used to share a custom domain with a number
@@ -39,6 +39,18 @@ If the example project ``Foo`` was set up with a custom domain,
3939
respectively be at: https://docs.example.com/en/latest/ and
4040
https://docs.example.com/projects/bar/en/latest/
4141

42+
Custom domain on subprojects
43+
----------------------------
44+
45+
Adding a custom domain to a subproject is allowed,
46+
but your documentation will always be served from
47+
the domain of the parent project.
48+
49+
For example, if the domain of a parent project is ``https://docs.example.com``,
50+
and you add the ``https://subproject.example.com/`` domain to one of its subprojects,
51+
it will always redirect to the domain of the parent project
52+
``https://docs.example.com/projects/subproject/``.
53+
4254
Search
4355
------
4456

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "readthedocs",
3-
"version": "7.1.2",
3+
"version": "7.4.1",
44
"description": "Read the Docs build dependencies",
55
"author": "Anthony Johnson <[email protected]>",
66
"scripts": {

pytest.ini

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,11 @@ filterwarnings =
1717
ignore:Using 'method_whitelist' with Retry is deprecated and will be removed in v2.0.*:DeprecationWarning
1818
# kombu
1919
ignore:SelectableGroups dict interface is deprecated.*:DeprecationWarning
20-
ignore:RemovedInDjango40Warning
21-
ignore:RemovedInDjango41Warning
20+
21+
# builtins
22+
ignore:DateTimeField .* received a naive datetime .* while time zone support is active:RuntimeWarning
23+
ignore:.*:DeprecationWarning
24+
25+
ignore:.*:django.utils.deprecation.RemovedInDjango40Warning
26+
ignore:.*:django.utils.deprecation.RemovedInDjango41Warning
27+
ignore:.*:elasticsearch.exceptions.ElasticsearchWarning

readthedocs/api/v2/mixins.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import structlog
22

3+
from readthedocs.core.utils import get_cache_tag
4+
35
log = structlog.get_logger(__name__)
46

57

@@ -37,10 +39,10 @@ def _get_cache_tags(self):
3739
version = self._get_version()
3840
tags = [
3941
project.slug,
40-
f'{project.slug}-{version.slug}',
42+
get_cache_tag(project.slug, version.slug),
4143
]
4244
if self.project_cache_tag:
43-
tags.append(f'{project.slug}-{self.project_cache_tag}')
45+
tags.append(get_cache_tag(project.slug, self.project_cache_tag))
4446
return tags
4547
except Exception as e:
4648
log.debug('Error while retrieving project and version for this view.')

readthedocs/api/v2/serializers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ class BuildSerializer(serializers.ModelSerializer):
145145
commit_url = serializers.ReadOnlyField(source='get_commit_url')
146146
# Jsonfield needs an explicit serializer
147147
# https://github.com/dmkoch/django-jsonfield/issues/188#issuecomment-300439829
148-
config = serializers.JSONField(required=False)
148+
config = serializers.JSONField(required=False, allow_null=True)
149149

150150
class Meta:
151151
model = Build

readthedocs/api/v2/views/integrations.py

Lines changed: 42 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@
33
import hashlib
44
import hmac
55
import json
6-
import structlog
76
import re
7+
from functools import namedtuple
88

9+
import structlog
910
from django.shortcuts import get_object_or_404
1011
from rest_framework import permissions, status
1112
from rest_framework.exceptions import NotFound, ParseError
@@ -14,11 +15,7 @@
1415
from rest_framework.status import HTTP_400_BAD_REQUEST
1516
from rest_framework.views import APIView
1617

17-
from readthedocs.core.signals import (
18-
webhook_bitbucket,
19-
webhook_github,
20-
webhook_gitlab,
21-
)
18+
from readthedocs.core.signals import webhook_bitbucket, webhook_github, webhook_gitlab
2219
from readthedocs.core.views.hooks import (
2320
build_branches,
2421
build_external_version,
@@ -27,7 +24,7 @@
2724
trigger_sync_versions,
2825
)
2926
from readthedocs.integrations.models import HttpExchange, Integration
30-
from readthedocs.projects.models import Feature, Project
27+
from readthedocs.projects.models import Project
3128

3229
log = structlog.get_logger(__name__)
3330

@@ -55,6 +52,12 @@
5552
BITBUCKET_PUSH = 'repo:push'
5653

5754

55+
ExternalVersionData = namedtuple(
56+
"ExternalVersionData",
57+
["id", "source_branch", "base_branch", "commit"],
58+
)
59+
60+
5861
class WebhookMixin:
5962

6063
"""Base class for Webhook mixins."""
@@ -228,20 +231,22 @@ def get_external_version_response(self, project):
228231
:param project: Project instance
229232
:type project: readthedocs.projects.models.Project
230233
"""
231-
identifier, verbose_name = self.get_external_version_data()
234+
version_data = self.get_external_version_data()
232235
# create or get external version object using `verbose_name`.
233236
external_version = get_or_create_external_version(
234-
project, identifier, verbose_name
237+
project=project,
238+
version_data=version_data,
235239
)
236240
# returns external version verbose_name (pull/merge request number)
237241
to_build = build_external_version(
238-
project=project, version=external_version, commit=identifier
242+
project=project,
243+
version=external_version,
239244
)
240245

241246
return {
242-
'build_triggered': True,
243-
'project': project.slug,
244-
'versions': [to_build],
247+
"build_triggered": bool(to_build),
248+
"project": project.slug,
249+
"versions": [to_build] if to_build else [],
245250
}
246251

247252
def get_deactivated_external_version_response(self, project):
@@ -259,9 +264,10 @@ def get_deactivated_external_version_response(self, project):
259264
:param project: Project instance
260265
:type project: Project
261266
"""
262-
identifier, verbose_name = self.get_external_version_data()
267+
version_data = self.get_external_version_data()
263268
deactivated_version = deactivate_external_version(
264-
project, identifier, verbose_name
269+
project=project,
270+
version_data=version_data,
265271
)
266272
return {
267273
'version_deactivated': bool(deactivated_version),
@@ -320,13 +326,16 @@ def get_data(self):
320326
def get_external_version_data(self):
321327
"""Get Commit Sha and pull request number from payload."""
322328
try:
323-
identifier = self.data['pull_request']['head']['sha']
324-
verbose_name = str(self.data['number'])
325-
326-
return identifier, verbose_name
327-
328-
except KeyError:
329-
raise ParseError('Parameters "sha" and "number" are required')
329+
data = ExternalVersionData(
330+
id=str(self.data["number"]),
331+
commit=self.data["pull_request"]["head"]["sha"],
332+
source_branch=self.data["pull_request"]["head"]["ref"],
333+
base_branch=self.data["pull_request"]["base"]["ref"],
334+
)
335+
return data
336+
except KeyError as e:
337+
key = e.args[0]
338+
raise ParseError(f"Invalid payload. {key} is required.")
330339

331340
def is_payload_valid(self):
332341
"""
@@ -431,7 +440,7 @@ def handle_webhook(self):
431440
(created or deleted),
432441
]):
433442
integration = self.get_integration()
434-
events = integration.provider_data.get('events', [])
443+
events = integration.provider_data.get('events', []) if integration.provider_data else [] # noqa
435444
if any([
436445
GITHUB_CREATE in events,
437446
GITHUB_DELETE in events,
@@ -523,13 +532,16 @@ def is_payload_valid(self):
523532
def get_external_version_data(self):
524533
"""Get commit SHA and merge request number from payload."""
525534
try:
526-
identifier = self.data['object_attributes']['last_commit']['id']
527-
verbose_name = str(self.data['object_attributes']['iid'])
528-
529-
return identifier, verbose_name
530-
531-
except KeyError:
532-
raise ParseError('Parameters "id" and "iid" are required')
535+
data = ExternalVersionData(
536+
id=str(self.data["object_attributes"]["iid"]),
537+
commit=self.data["object_attributes"]["last_commit"]["id"],
538+
source_branch=self.data["object_attributes"]["source_branch"],
539+
base_branch=self.data["object_attributes"]["target_branch"],
540+
)
541+
return data
542+
except KeyError as e:
543+
key = e.args[0]
544+
raise ParseError(f"Invalid payload. {key} is required.")
533545

534546
def handle_webhook(self):
535547
"""

0 commit comments

Comments
 (0)