Skip to content

Commit 4f3f344

Browse files
committed
Merge tag '8.4.2' into relcorp
2 parents 464820f + 8f38a84 commit 4f3f344

38 files changed

+1284
-501
lines changed

CHANGELOG.rst

+23
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,26 @@
1+
Version 8.4.2
2+
-------------
3+
4+
:Date: August 29, 2022
5+
6+
* `@ericholscher <https://github.com/ericholscher>`__: Proxito redirects: pass full_path instead of re-creating it. (`#9557 <https://github.com/readthedocs/readthedocs.org/pull/9557>`__)
7+
* `@humitos <https://github.com/humitos>`__: Build: cancel old builds (`#9549 <https://github.com/readthedocs/readthedocs.org/pull/9549>`__)
8+
* `@stsewd <https://github.com/stsewd>`__: Embedded js: update docstring (`#9547 <https://github.com/readthedocs/readthedocs.org/pull/9547>`__)
9+
* `@benjaoming <https://github.com/benjaoming>`__: Docs: HTML form for getting in touch with Read the Docs for Science (`#9543 <https://github.com/readthedocs/readthedocs.org/pull/9543>`__)
10+
* `@stsewd <https://github.com/stsewd>`__: Unresolver: port changes from #9540 (`#9542 <https://github.com/readthedocs/readthedocs.org/pull/9542>`__)
11+
* `@stsewd <https://github.com/stsewd>`__: Domains: test tasks with organizations (`#9541 <https://github.com/readthedocs/readthedocs.org/pull/9541>`__)
12+
* `@stsewd <https://github.com/stsewd>`__: Proxito: set logging to debug (`#9540 <https://github.com/readthedocs/readthedocs.org/pull/9540>`__)
13+
* `@humitos <https://github.com/humitos>`__: Dependencies: pin deploy dependencies (`#9537 <https://github.com/readthedocs/readthedocs.org/pull/9537>`__)
14+
* `@humitos <https://github.com/humitos>`__: Release 8.4.1 (`#9536 <https://github.com/readthedocs/readthedocs.org/pull/9536>`__)
15+
* `@humitos <https://github.com/humitos>`__: Dependencies: pin django-structlog to 2.2.1 (`#9535 <https://github.com/readthedocs/readthedocs.org/pull/9535>`__)
16+
* `@humitos <https://github.com/humitos>`__: Code comment (`#9518 <https://github.com/readthedocs/readthedocs.org/pull/9518>`__)
17+
* `@stsewd <https://github.com/stsewd>`__: Embedded js: remove more dependency on jquery (`#9515 <https://github.com/readthedocs/readthedocs.org/pull/9515>`__)
18+
* `@humitos <https://github.com/humitos>`__: Telemetry: collect user's requirements (`#9514 <https://github.com/readthedocs/readthedocs.org/pull/9514>`__)
19+
* `@stsewd <https://github.com/stsewd>`__: Embedded js: remove some dependency from jquery (`#9508 <https://github.com/readthedocs/readthedocs.org/pull/9508>`__)
20+
* `@stsewd <https://github.com/stsewd>`__: New unresolver implementation (`#9500 <https://github.com/readthedocs/readthedocs.org/pull/9500>`__)
21+
* `@stsewd <https://github.com/stsewd>`__: Use djstripe models for organization subscriptions (`#9486 <https://github.com/readthedocs/readthedocs.org/pull/9486>`__)
22+
* `@benjaoming <https://github.com/benjaoming>`__: Park resolutions to common build problems in FAQ (`#9472 <https://github.com/readthedocs/readthedocs.org/pull/9472>`__)
23+
124
Version 8.4.1
225
-------------
326

common

docs/conf.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969

7070
master_doc = "index"
7171
copyright = "2010, Read the Docs, Inc & contributors"
72-
version = "8.4.1"
72+
version = "8.4.2"
7373
release = version
7474
exclude_patterns = ["_build"]
7575
default_role = "obj"

docs/user/build-troubleshooting.rst

+82
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
Build troubleshooting
2+
=====================
3+
4+
This section is very specific and may change over time.
5+
Please help us keep it updated and contribute your own build errors and resolutions.
6+
7+
8+
Git errors
9+
----------
10+
11+
In the examples below, we use ``github.com``, however error messages are similar for GitLab, Bitbucket etc.
12+
13+
14+
terminal prompts disabled
15+
~~~~~~~~~~~~~~~~~~~~~~~~~
16+
17+
.. code-block:: text
18+
19+
fatal: could not read Username for 'https://github.com': terminal prompts disabled
20+
21+
**Resolution:** This error can be quite misleading. It usually occurs when a repository could not be found because of a typo in the reposistory name or because the repository has been deleted. Verify your repository URL in :guilabel:`Admin > Advanced Settings`.
22+
23+
This error also occurs if you have changed a ``public`` repository to ``private`` and you are using ``https://`` in your git repository URL.
24+
25+
.. note::
26+
27+
To use private repositories, you need a plan on `Read the Docs for Business <https://readthedocs.com>`__.
28+
29+
30+
error: pathspec
31+
~~~~~~~~~~~~~~~
32+
33+
.. code-block:: text
34+
35+
error: pathspec 'main' did not match any file(s) known to git
36+
37+
**Resolution:** A specified branch does not exist in the git repository.
38+
This might be because the git repository was recently created (and has no commits nor branches) or because the default branch has changed name. If for instance, the default branch on GitHub changed from ``master`` to ``main``, you need to visit :guilabel:`Admin > Advanced Settings` to change the name of the default branch that Read the Docs expects to find when cloning the repository.
39+
40+
41+
Permission denied (publickey)
42+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
43+
44+
.. code-block:: text
45+
46+
[email protected]: Permission denied (publickey).
47+
48+
fatal: Could not read from remote repository.
49+
50+
**Resolution:** The git repository URL points to a repository, user account or organization that Read the Docs does not have credentials for. Verify that the public SSH key from your Read the Docs project is installed as a *deploy key* on your VCS (GitHub/GitLab/Bitbucket etc):
51+
52+
.. This should be included as a snippet since it's used 2 times already
53+
54+
1. Navigate to :guilabel:`Admin > SSH Keys`
55+
2. Copy the contents of the public key.
56+
3. Ensure that the key exists as a deploy key at your VCS provider. Here are direct links to access settings for verifying and changing deploy keys - customize the URLs for your VCS host and repository details:
57+
58+
- ``https://github.com/<username>/<repo>/settings/keys``
59+
- ``https://gitlab.com/<username>/<repo>/-/settings/repository``
60+
- ``https://bitbucket.org/<username>/<repo>/admin/access-keys/``
61+
62+
63+
64+
ERROR: Repository not found.
65+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
66+
67+
.. code-block:: text
68+
69+
ERROR: Repository not found.
70+
fatal: Could not read from remote repository.
71+
72+
**Resolution:** This error usually occurs on private git repositories that no longer have the public SSH key from their Read the Docs project installed as a *deploy key*.
73+
74+
1. Navigate to :guilabel:`Admin > SSH Keys`
75+
2. Copy the contents of the public key.
76+
3. Ensure that the key exists as a deploy key at your VCS provider. Here are direct links to access settings for verifying and changing deploy keys - customize the URLs for your VCS host and repository details:
77+
78+
- ``https://github.com/<username>/<repo>/settings/keys``
79+
- ``https://gitlab.com/<username>/<repo>/-/settings/repository``
80+
- ``https://bitbucket.org/<username>/<repo>/admin/access-keys/``
81+
82+
This error is rare for public repositories. If your repository is public and you see this error, it may be because you have specified a wrong domain or forgotten a component in the path.

docs/user/index.rst

+1
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ and some of the core features of Read the Docs.
121121

122122
/builds
123123
/build-customization
124+
/build-troubleshooting
124125
/environment-variables
125126
/badges
126127

docs/user/science.rst

+115
Original file line numberDiff line numberDiff line change
@@ -159,3 +159,118 @@ Read the Docs community for science is already big and keeps growing. The :exter
159159
:link: https://feature-engine.readthedocs.io/en/latest/
160160

161161
.. Let's put some logos to sign off
162+
163+
164+
How would you use Read the Docs for Science?
165+
--------------------------------------------
166+
167+
Would you like to get started with Read the Docs or understand more about the platform? Would you like to help us improve by telling us more about an already existing project?
168+
169+
Please take 2 minutes to fill in this form.
170+
171+
.. raw:: html
172+
173+
<form
174+
method="POST"
175+
name="fa-form-1"
176+
action="https://webhook.frontapp.com/forms/036c4169294f3b04abaa/xP2Ulmxfcgl_mLJrFbGoefmVuqmH7DAfyHD9lt_qbk1heKFev5K8-TEhmpKc8dWdn-rv7bbZMMPjmffxl0mqGRUcrfyOzImtk8zEGJ04E1uuyPE28hqoHExtS20"
177+
enctype="multipart/form-data"
178+
accept-charset="utf-8"
179+
>
180+
181+
.. list-table::
182+
:widths: 30 70
183+
184+
* - Name:
185+
- |input-name|
186+
* - Email:
187+
- |input-email|
188+
* - What science department are you from, |br| which science field(s) do you work in?
189+
- |input-deparment-science-field|
190+
* - Which of these are important to you?
191+
- |input-interests|
192+
* - Tell us more about your usecase:
193+
- |input-usecase|
194+
* - Should we contact you?
195+
- |input-contact-me|
196+
197+
198+
.. raw:: html
199+
200+
<p>
201+
<button type="submit" class="btn btn-neutral" style="font-size: 150%">Submit form</button>
202+
</p>
203+
</form>
204+
205+
206+
.. |br| raw:: html
207+
208+
<br />
209+
210+
.. |input-email| raw:: html
211+
212+
<input type="email" name="email">
213+
214+
.. |input-name| raw:: html
215+
216+
<input type="text" name="name">
217+
218+
.. |input-deparment-science-field| raw:: html
219+
220+
<textarea name="department-science-field" rows="10" style="width: 90%; height: 100px;"></textarea>
221+
222+
.. |input-interests| raw:: html
223+
224+
<label for="what1">
225+
<input id="what1" type="checkbox" name="interests-academic-publishing" value="1">
226+
Academic publishing (PDFs)
227+
</label>
228+
229+
<label for="what2">
230+
<input id="what2" type="checkbox" name="interests-git-hosting" value="1">
231+
Maintaining my project with Git
232+
</label>
233+
234+
<label for="what3">
235+
<input id="what3" type="checkbox" name="interests-visualizations" value="1">
236+
Up-to-date visualizations and computations
237+
</label>
238+
239+
<label for="what4">
240+
<input id="what4" type="checkbox" name="interests-interactive" value="1">
241+
Interactive visualizations for users
242+
</label>
243+
244+
<label for="what5">
245+
<input id="what5" type="checkbox" name="interests-collaboration" value="1">
246+
Collaboration and/or getting more community contribution
247+
</label>
248+
249+
<label for="what6">
250+
<input id="what6" type="checkbox" name="interests-hosting-navigation" value="1">
251+
Publishing and hosting courses and research departments
252+
</label>
253+
254+
<label for="what7">
255+
<input id="what7" type="checkbox" name="interests-search-analytics" value="1">
256+
Search and analytics
257+
</label>
258+
259+
<label for="what8">
260+
<input id="what8" type="checkbox" name="interests-search-analytics" value="1">
261+
Previewing new proposals (pull requests)
262+
</label>
263+
264+
<input id="body" name="body" type="hidden" value="Science Docs Submission">
265+
266+
.. |input-contact-me| raw:: html
267+
268+
<label for="contact">
269+
<input id="contact" type="checkbox" name="contact-me" value="yes">
270+
Yes please
271+
</label>
272+
273+
274+
.. |input-usecase| raw:: html
275+
276+
<textarea name="usecase" rows="10" style="width: 90%; height: 100px;"></textarea>

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "readthedocs",
3-
"version": "8.4.1",
3+
"version": "8.4.2",
44
"description": "Read the Docs build dependencies",
55
"author": "Read the Docs, Inc <[email protected]>",
66
"scripts": {

readthedocs/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
"""Read the Docs."""
22

33

4-
__version__ = "8.4.1"
4+
__version__ = "8.4.2"

readthedocs/analytics/proxied_api.py

+4-5
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
from readthedocs.analytics.models import PageView
1010
from readthedocs.api.v2.permissions import IsAuthorizedToViewVersion
11-
from readthedocs.core.unresolver import unresolve_from_request
11+
from readthedocs.core.unresolver import unresolve
1212
from readthedocs.core.utils.extend import SettingsOverrideObject
1313
from readthedocs.projects.models import Project
1414

@@ -50,18 +50,17 @@ def get(self, request, *args, **kwargs):
5050
version = self._get_version()
5151
absolute_uri = self.request.GET.get('absolute_uri')
5252
self.increase_page_view_count(
53-
request=request,
5453
project=project,
5554
version=version,
5655
absolute_uri=absolute_uri,
5756
)
5857
return Response(status=200)
5958

6059
# pylint: disable=no-self-use
61-
def increase_page_view_count(self, request, project, version, absolute_uri):
60+
def increase_page_view_count(self, project, version, absolute_uri):
6261
"""Increase the page view count for the given project."""
63-
unresolved = unresolve_from_request(request, absolute_uri)
64-
if not unresolved:
62+
unresolved = unresolve(absolute_uri)
63+
if not unresolved or not unresolved.filename:
6564
return
6665

6766
path = unresolved.filename

readthedocs/api/mixins.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ def _get_version(self):
9999
return
100100

101101
if self.unresolved_url:
102-
version_slug = self.unresolved_url.version_slug
102+
version_slug = self.unresolved_url.version.slug
103103
else:
104104
version_slug = self.request.GET.get("version", "latest")
105105
project = self._get_project()
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
from unittest import mock
2+
3+
import django_dynamic_fixture as fixture
4+
import pytest
5+
6+
from readthedocs.builds.constants import (
7+
BUILD_FINAL_STATES,
8+
BUILD_STATE_BUILDING,
9+
BUILD_STATE_CANCELLED,
10+
BUILD_STATE_CLONING,
11+
BUILD_STATE_FINISHED,
12+
BUILD_STATE_INSTALLING,
13+
BUILD_STATE_TRIGGERED,
14+
BUILD_STATE_UPLOADING,
15+
)
16+
from readthedocs.builds.models import Build, Version
17+
from readthedocs.core.utils import trigger_build
18+
from readthedocs.projects.models import Feature, Project
19+
20+
21+
@pytest.mark.django_db
22+
class TestCancelOldBuilds:
23+
@pytest.fixture(autouse=True)
24+
def setup(self):
25+
self.project = fixture.get(Project)
26+
self.version = fixture.get(Version, project=self.project)
27+
self.feature = fixture.get(Feature, feature_id=Feature.CANCEL_OLD_BUILDS)
28+
self.feature.projects.add(self.project)
29+
30+
@pytest.mark.parametrize(
31+
"state",
32+
[
33+
BUILD_STATE_TRIGGERED,
34+
BUILD_STATE_CLONING,
35+
BUILD_STATE_INSTALLING,
36+
BUILD_STATE_BUILDING,
37+
BUILD_STATE_UPLOADING,
38+
],
39+
)
40+
@mock.patch("readthedocs.core.utils.cancel_build")
41+
@mock.patch("readthedocs.projects.tasks.builds.update_docs_task")
42+
def test_cancel_old_running_build(self, update_docs_task, cancel_build, state):
43+
# Create a running build
44+
build = fixture.get(
45+
Build, project=self.project, version=self.version, state=state
46+
)
47+
48+
builds_count_before = Build.objects.count()
49+
50+
# Trigger a new build for the same project/version
51+
result = trigger_build(
52+
project=self.project,
53+
version=self.version,
54+
)
55+
56+
triggered_build = Build.objects.first()
57+
builds_count_after = Build.objects.count()
58+
59+
cancel_build.assert_called_once_with(build)
60+
assert result == (mock.ANY, triggered_build)
61+
assert builds_count_before == builds_count_after - 1
62+
assert update_docs_task.signature.called
63+
assert update_docs_task.signature().apply_async.called
64+
65+
@pytest.mark.parametrize(
66+
"state",
67+
[
68+
BUILD_STATE_CANCELLED,
69+
BUILD_STATE_FINISHED,
70+
],
71+
)
72+
@mock.patch("readthedocs.core.utils.cancel_build")
73+
@mock.patch("readthedocs.projects.tasks.builds.update_docs_task")
74+
def test_not_cancel_old_finished_build(self, update_docs_task, cancel_build, state):
75+
# Create a running build
76+
build = fixture.get(
77+
Build, project=self.project, version=self.version, state=state
78+
)
79+
80+
builds_count_before = Build.objects.count()
81+
82+
# Trigger a new build for the same project/version
83+
result = trigger_build(
84+
project=self.project,
85+
version=self.version,
86+
)
87+
88+
triggered_build = Build.objects.first()
89+
builds_count_after = Build.objects.count()
90+
91+
cancel_build.assert_not_called()
92+
assert result == (mock.ANY, triggered_build)
93+
assert builds_count_before == builds_count_after - 1
94+
assert update_docs_task.signature.called
95+
assert update_docs_task.signature().apply_async.called

0 commit comments

Comments
 (0)