Skip to content

Commit 2063793

Browse files
authored
Config file: add support for latest aliases (#11081)
* Config file: add support for latest aliases - Closes #8861 - Closes #10912 Ref readthedocs/meta#140 * User variables to make it shorter * Update OS * Updates from review * Rename ubuntu-latest-lts to ubuntu-lts-latest * Add alias for ruby
1 parent 74b4541 commit 2063793

File tree

3 files changed

+73
-19
lines changed

3 files changed

+73
-19
lines changed

docs/user/config-file/v2.rst

+30-2
Original file line numberDiff line numberDiff line change
@@ -274,9 +274,18 @@ Image names refer to the operating system Read the Docs uses to build them.
274274
Arbitrary Docker images are not supported.
275275

276276
:Type: ``string``
277-
:Options: ``ubuntu-20.04``, ``ubuntu-22.04``
277+
:Options: ``ubuntu-20.04``, ``ubuntu-22.04``, ``ubuntu-lts-latest``
278278
:Required: ``true``
279279

280+
.. note::
281+
282+
The ``ubuntu-lts-latest`` option refers to the latest Ubuntu LTS version of Ubuntu available on Read the Docs,
283+
which may not match the latest Ubuntu LTS officially released.
284+
285+
.. warning::
286+
287+
Using ``ubuntu-lts-latest`` may break your builds unexpectedly if your project isn't compatible with the newest Ubuntu LTS version when it's updated by Read the Docs.
288+
280289
build.tools
281290
```````````
282291

@@ -286,6 +295,16 @@ Version specifiers for each tool. It must contain at least one tool.
286295
:Options: ``python``, ``nodejs``, ``ruby``, ``rust``, ``golang``
287296
:Required: ``true``
288297

298+
.. note::
299+
300+
Each tool has a ``latest`` option available, which refers to the latest version available on Read the Docs,
301+
which may not match the latest version officially released.
302+
Versions and the ``latest`` option are updated at least once every six months to keep up with the latest releases.
303+
304+
.. warning::
305+
306+
Using ``latest`` may break your builds unexpectedly if your project isn't compatible with the newest version of the tool when it's updated by Read the Docs.
307+
289308
build.tools.python
290309
``````````````````
291310

@@ -301,17 +320,20 @@ You can use several interpreters and versions, from CPython, Miniconda, and Mamb
301320
:Type: ``string``
302321
:Options:
303322
- ``2.7``
304-
- ``3`` (last stable CPython version)
323+
- ``3`` (alias for the latest 3.x version available on Read the Docs)
305324
- ``3.6``
306325
- ``3.7``
307326
- ``3.8``
308327
- ``3.9``
309328
- ``3.10``
310329
- ``3.11``
311330
- ``3.12``
331+
- ``latest`` (alias for the latest version available on Read the Docs)
312332
- ``miniconda3-4.7``
333+
- ``miniconda-latest`` (alias for the latest version available on Read the Docs)
313334
- ``mambaforge-4.10``
314335
- ``mambaforge-22.9``
336+
- ``mambaforge-latest`` (alias for the latest version available on Read the Docs)
315337

316338
build.tools.nodejs
317339
``````````````````
@@ -325,6 +347,7 @@ Node.js version to use.
325347
- ``18``
326348
- ``19``
327349
- ``20``
350+
- ``latest`` (alias for the latest version available on Read the Docs)
328351

329352
build.tools.ruby
330353
````````````````
@@ -334,6 +357,7 @@ Ruby version to use.
334357
:Type: ``string``
335358
:Options:
336359
- ``3.3``
360+
- ``latest`` (alias for the latest version available on Read the Docs)
337361

338362
build.tools.rust
339363
````````````````
@@ -346,6 +370,8 @@ Rust version to use.
346370
- ``1.61``
347371
- ``1.64``
348372
- ``1.70``
373+
- ``1.75``
374+
- ``latest`` (alias for the latest version available on Read the Docs)
349375

350376
build.tools.golang
351377
``````````````````
@@ -358,6 +384,8 @@ Go version to use.
358384
- ``1.18``
359385
- ``1.19``
360386
- ``1.20``
387+
- ``1.21``
388+
- ``latest`` (alias for the latest version available on Read the Docs)
361389

362390
build.apt_packages
363391
``````````````````

readthedocs/builds/constants_docker.py

+23-12
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,17 @@
99

1010
DOCKER_DEFAULT_IMAGE = "readthedocs/build"
1111

12-
# Adding a new tool/version to this setting requires:
12+
# When adding a new tool/version to this setting, you should:
1313
#
14-
# - a mapping between the expected version in the config file, to the full
15-
# version installed via asdf (found via ``asdf list all <tool>``)
16-
#
17-
# - running the script ``./scripts/compile_version_upload.sh`` in
18-
# development and production environments to compile and cache the new
19-
# tool/version
20-
#
21-
# Note that when updating this options, you should also update the file:
22-
# readthedocs/rtd_tests/fixtures/spec/v2/schema.json
14+
# - Add a mapping between the expected version in the config file, to the full
15+
# version installed via asdf (found via ``asdf list all <tool>``).
16+
# - Run the script ``./scripts/compile_version_upload.sh`` in
17+
# development to compile and cache the new tool/version.
18+
# - Update the CircleCI job on the ``readthedocs-docker-images`` repository with the new versions at
19+
# https://github.com/rtfd/readthedocs-docker-images/blob/d2760526abdfe27001946614b749abf8011b7f90/.circleci/config.yml#L38-L44.
20+
# - Update the latest aliases for OS and tools (below this setting).
21+
# - Update readthedocs/rtd_tests/fixtures/spec/v2/schema.json.
22+
# - Update the documentation in ``docs/user/config-file/v2.rst``.
2323
RTD_DOCKER_BUILD_SETTINGS = {
2424
# Mapping of build.os options to docker image.
2525
"os": {
@@ -37,8 +37,6 @@
3737
"3.10": "3.10.13",
3838
"3.11": "3.11.6",
3939
"3.12": "3.12.0",
40-
# Always point to the latest stable release.
41-
"3": "3.12.0",
4240
"miniconda3-4.7": "miniconda3-4.7.12",
4341
"mambaforge-4.10": "mambaforge-4.10.3-10",
4442
"mambaforge-22.9": "mambaforge-22.9.0-3",
@@ -69,3 +67,16 @@
6967
},
7068
},
7169
}
70+
71+
# Set latest aliases for OS and tools.
72+
_OS = RTD_DOCKER_BUILD_SETTINGS["os"]
73+
_TOOLS = RTD_DOCKER_BUILD_SETTINGS["tools"]
74+
_OS["ubuntu-lts-latest"] = _OS["ubuntu-22.04"]
75+
_TOOLS["python"]["3"] = _TOOLS["python"]["3.12"]
76+
_TOOLS["python"]["latest"] = _TOOLS["python"]["3"]
77+
_TOOLS["python"]["miniconda-latest"] = _TOOLS["python"]["miniconda3-4.7"]
78+
_TOOLS["python"]["mambaforge-latest"] = _TOOLS["python"]["mambaforge-22.9"]
79+
_TOOLS["nodejs"]["latest"] = _TOOLS["nodejs"]["20"]
80+
_TOOLS["ruby"]["latest"] = _TOOLS["ruby"]["3.3"]
81+
_TOOLS["rust"]["latest"] = _TOOLS["rust"]["1.75"]
82+
_TOOLS["golang"]["latest"] = _TOOLS["golang"]["1.21"]

readthedocs/rtd_tests/fixtures/spec/v2/schema.json

+20-5
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@
6060
"description": "Operating system to be used in the build.",
6161
"enum": [
6262
"ubuntu-20.04",
63-
"ubuntu-22.04"
63+
"ubuntu-22.04",
64+
"ubuntu-lts-latest"
6465
]
6566
},
6667
"jobs": {
@@ -150,9 +151,12 @@
150151
"3.10",
151152
"3.11",
152153
"3.12",
154+
"latest",
153155
"miniconda3-4.7",
156+
"miniconda-latest",
154157
"mambaforge-4.10",
155-
"mambaforge-22.9"
158+
"mambaforge-22.9",
159+
"mambaforge-latest"
156160
]
157161
},
158162
"nodejs": {
@@ -161,23 +165,34 @@
161165
"16",
162166
"18",
163167
"19",
164-
"20"
168+
"20",
169+
"latest"
170+
]
171+
},
172+
"ruby": {
173+
"enum": [
174+
"3.3",
175+
"latest"
165176
]
166177
},
167178
"rust": {
168179
"enum": [
169180
"1.55",
170181
"1.61",
171182
"1.64",
172-
"1.70"
183+
"1.70",
184+
"1.75",
185+
"latest"
173186
]
174187
},
175188
"golang": {
176189
"enum": [
177190
"1.17",
178191
"1.18",
179192
"1.19",
180-
"1.20"
193+
"1.20",
194+
"1.21",
195+
"latest"
181196
]
182197
}
183198
},

0 commit comments

Comments
 (0)