|
6 | 6 | # -- Project information ----------------------------------------------------- |
7 | 7 | # https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information |
8 | 8 |
|
| 9 | +import asyncio |
9 | 10 | import os |
10 | 11 | import sys |
11 | 12 |
|
12 | | -import requests |
| 13 | +from jumpstarter_cli_admin.controller import get_latest_compatible_controller_version |
13 | 14 |
|
14 | 15 | sys.path.insert(0, os.path.abspath("../..")) |
15 | 16 |
|
16 | 17 | project = "jumpstarter" |
17 | 18 | copyright = "2025, Jumpstarter Contributors" |
18 | 19 | author = "Jumpstarter Contributors" |
19 | 20 |
|
20 | | -controller_version = requests.get( |
21 | | - "https://quay.io/api/v1/repository/jumpstarter-dev/helm/jumpstarter/tag/", params={"limit": 1} |
22 | | -).json()["tags"][0]["name"] |
23 | | - |
24 | 21 | # -- General configuration --------------------------------------------------- |
25 | 22 | # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration |
26 | 23 |
|
|
54 | 51 | html_favicon = "_static/img/favicon.png" |
55 | 52 | html_show_sphinx = False |
56 | 53 |
|
| 54 | + |
| 55 | +def get_controller_version(): |
| 56 | + name = os.getenv("SPHINX_MULTIVERSION_NAME") |
| 57 | + if name == "main" or name is None: |
| 58 | + version = None |
| 59 | + elif name.startswith("release-"): |
| 60 | + version = name.removeprefix("release-") |
| 61 | + else: |
| 62 | + version = None |
| 63 | + |
| 64 | + return asyncio.run(get_latest_compatible_controller_version(client_version=version)) |
| 65 | + |
| 66 | + |
| 67 | +def get_index_url(): |
| 68 | + name = os.getenv("SPHINX_MULTIVERSION_NAME") |
| 69 | + if name is None: |
| 70 | + return "https://pkg.jumpstarter.dev/simple" |
| 71 | + else: |
| 72 | + return "https://pkg.jumpstarter.dev/{}/simple".format(name) |
| 73 | + |
| 74 | + |
57 | 75 | myst_heading_anchors = 3 |
58 | 76 | myst_enable_extensions = [ |
59 | 77 | "substitution", |
60 | 78 | ] |
61 | 79 | myst_substitutions = { |
62 | 80 | "requires_python": ">=3.11", |
63 | 81 | "version": "latest", |
64 | | - "controller_version": controller_version, |
| 82 | + "controller_version": get_controller_version(), |
| 83 | + "index_url": get_index_url(), |
65 | 84 | } |
66 | 85 |
|
67 | 86 | doctest_test_doctest_blocks = "" |
|
91 | 110 | # This replaces the custom bash script approach with built-in functionality |
92 | 111 |
|
93 | 112 | # Tags pattern for html_context["versions"] |
94 | | -smv_tag_whitelist = r"^v(0\.[5-9](\.\d+)|0\.[1-9][0-9]+(\.\d+)|[1-9]\d*\.\d+\.\d+)$" # Starting from v0.5.0 |
95 | | -smv_branch_whitelist = r"^(main|master)$" # Only include main/master branch |
96 | | -smv_remote_whitelist = None |
97 | | -smv_released_pattern = r"^v[0-9]+\.[0-9]+\.[0-9]+$" # Tags that are considered releases |
| 113 | +smv_tag_whitelist = r"$^" # Ignore all tags |
| 114 | +smv_branch_whitelist = r"^(main|release-\d+\.\d+)$" # Include all release branches and main |
| 115 | +smv_remote_whitelist = r'^(origin|upstream)$' # Include branches from origin and upstream |
| 116 | +smv_prefer_remote_refs = True |
| 117 | +# smv_released_pattern = r"^v[0-9]+\.[0-9]+\.[0-9]+$" # Tags that are considered releases |
98 | 118 | smv_outputdir_format = "{ref.name}" # Directory name format |
99 | 119 |
|
100 | 120 | # Ensure static files are copied to all versions |
|
0 commit comments