Skip to content

Commit a166f6f

Browse files
committed
docs: update the upgrade talos version make target
Signed-off-by: Amarachi Iheanacho <amarachi.iheanacho@siderolabs.com>
1 parent 3ef13dc commit a166f6f

4 files changed

Lines changed: 345 additions & 190 deletions

File tree

Makefile

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ TALOS_VERSION := v1.14
1616
VALE_IMAGE := jdkato/vale:latest
1717
VALE_CONFIG ?= .vale.ini
1818

19+
# Auto-fill the GitHub token from `gh` when it isn't already set in the environment.
20+
# An exported/CI value wins; otherwise fall back to the local gh keychain. If gh is
21+
# unavailable this is simply empty, matching the previous behaviour.
22+
GITHUB_TOKEN ?= $(shell gh auth token 2>/dev/null)
23+
1924
# Default target
2025
.PHONY: help
2126
help: ## Show this help message
@@ -332,28 +337,32 @@ validate-docs-nav: ## Validate all talos yaml nav configs match their content di
332337
cd docs-validate && go run . --workspace ..
333338

334339
.PHONY: upgrade-talos-version
335-
upgrade-talos-version: ## Upgrade docs to the next Talos minor version (fetches versions from GitHub)
340+
upgrade-talos-version: ## Upgrade Talos docs to a release tag: make upgrade-talos-version TAG=v1.14.0-beta.0
341+
@test -n "$(TAG)" || { echo "Error: TAG is required, e.g. make upgrade-talos-version TAG=v1.14.0-beta.0"; exit 1; }
336342
docker run --rm -it -v $(PWD):/workspace -w /workspace \
337343
-e GITHUB_TOKEN=$(GITHUB_TOKEN) \
338-
$(VERSION_UPGRADE_IMAGE)
339-
$(eval NEW_VERSION := $(shell cat .upgrade-version-tmp))
344+
$(VERSION_UPGRADE_IMAGE) --tag $(TAG)
345+
$(eval NEW_VERSION := $(shell cat .upgrade-version-tmp 2>/dev/null))
340346
@rm -f .upgrade-version-tmp
347+
$(MAKE) generate-talos-reference
341348
$(MAKE) changelog
342349
$(MAKE) docs.json
343350
$(MAKE) validate-docs-nav
344351
@echo ""
345-
@echo "Upgrade to $(NEW_VERSION) complete! Run: make preview to preview your $(NEW_VERSION) docs"
352+
@echo "Upgrade to $(TAG) complete! Run: make preview to preview your $(NEW_VERSION) docs"
346353

347354
.PHONY: upgrade-talos-version-local
348-
upgrade-talos-version-local: ## Upgrade docs to the next Talos minor version using local Go build
349-
cd version-upgrade-gen && go run . --workspace ..
350-
$(eval NEW_VERSION := $(shell cat .upgrade-version-tmp))
355+
upgrade-talos-version-local: ## Same as upgrade-talos-version but using the local Go build
356+
@test -n "$(TAG)" || { echo "Error: TAG is required, e.g. make upgrade-talos-version-local TAG=v1.14.0-beta.0"; exit 1; }
357+
cd version-upgrade-gen && go run . --workspace .. --tag $(TAG)
358+
$(eval NEW_VERSION := $(shell cat .upgrade-version-tmp 2>/dev/null))
351359
@rm -f .upgrade-version-tmp
360+
$(MAKE) generate-talos-reference-local
352361
$(MAKE) changelog
353362
$(MAKE) docs.json
354363
$(MAKE) validate-docs-nav
355364
@echo ""
356-
@echo "Upgrade to $(NEW_VERSION) complete! Run: make preview to preview your $(NEW_VERSION) docs"
365+
@echo "Upgrade to $(TAG) complete! Run: make preview to preview your $(NEW_VERSION) docs"
357366

358367
.PHONY: build-version-upgrade-container
359368
build-version-upgrade-container: ## Build the version-upgrade-gen container locally

public/snippets/custom-variables.mdx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,8 @@ export const nvidia_container_toolkit_release_v1_13 = "v1.19.0"
7272
export const nvidia_driver_release_v1_13 = "580.126.20"
7373

7474
{/* 1.14 talos release */}
75-
export const release_v1_14 = 'v1.14.0-alpha.0'
75+
export const release_v1_14 = 'v1.14.0-alpha.2'
7676
export const release_branch_v1_14 = 'release-1.14'
7777
export const version_v1_14 = 'v1.14'
7878
export const nvidia_container_toolkit_release_v1_14 = "v1.19.0"
7979
export const nvidia_driver_release_v1_14 = "580.126.20"
80-

version-upgrade-gen/README.md

Lines changed: 59 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,81 @@
11
# version-upgrade-gen
22

3-
A Go tool that automates upgrading the Talos documentation to the next version.
3+
A Go tool that points the Talos documentation at a specific Talos release tag.
44

55
## What it does
66

7-
When run, it prompts you to select a release type and then:
8-
9-
**Beta release**
10-
- Updates the versioned variables block in `custom-variables.mdx` with the new beta tag (e.g. `v1.14.0-beta.0`)
11-
- Adds the new `talos-vX.Y.yaml` at the bottom of the nav in all four Makefile targets so the beta version appears last in the version dropdown
12-
13-
**Stable release**
14-
- Updates the "latest stable" block in `custom-variables.mdx` with the new version's Kubernetes and nvidia versions (fetched from GitHub)
15-
- Updates or creates the versioned variables block in `custom-variables.mdx`
16-
- Updates the version warning banner to point to the new latest version
17-
- Updates all canonical URLs across older version docs to point to the new version
18-
- Moves the new `talos-vX.Y.yaml` to the top of the nav in all four Makefile targets
19-
- Updates `TALOSCTL_IMAGE` and `TALOS_VERSION` in the Makefile
7+
You pass the exact target image tag with `--tag` (e.g. `v1.14.0-beta.0` or
8+
`v1.14.0`). The tool reads the current tag from `TALOSCTL_IMAGE` in the Makefile
9+
and derives everything else from the two tags:
10+
11+
- **Stage** (alpha / beta / stable) comes from the tag's suffix — there is no
12+
interactive prompt.
13+
- **Folder** (`TALOS_VERSION`, e.g. `v1.14`) is the tag's `major.minor`. Moving a
14+
minor through alpha → beta → stable keeps the same folder; only a genuinely new
15+
minor changes it.
16+
17+
**Pre-release target (alpha/beta)**
18+
- Rewrites `TALOSCTL_IMAGE` to the exact tag and `TALOS_VERSION` to the folder minor
19+
- Updates (or appends) the versioned variables block in `custom-variables.mdx` with the tag
20+
- Leaves the "latest stable" pointer (banner, canonical URLs, latest-stable block) untouched
21+
- **Navigation differs by stage:**
22+
- **alpha** — leaves the `docs.json`/`check-missing` nav lists unchanged. The reference
23+
docs are still generated on disk, but the version stays out of the published nav.
24+
- **beta** — ensures `talos-vX.Y.yaml` is present at the bottom of the nav in all four
25+
Makefile targets so the version appears last in the dropdown. This is idempotent, so
26+
a beta correctly adds the entry that an earlier alpha of the same minor skipped.
27+
28+
**Stable target**
29+
- Rewrites `TALOSCTL_IMAGE` to the exact tag and `TALOS_VERSION` to the folder minor
30+
- Updates the "latest stable" block in `custom-variables.mdx` with the release's
31+
Kubernetes (from the `siderolabs/talos` release notes) and nvidia versions, and
32+
updates/creates the versioned block
33+
- Only when the latest stable minor actually changes (read from the version warning
34+
banner, not from `TALOS_VERSION`): updates the banner, rewrites canonical URLs
35+
across older version docs, and moves `talos-vX.Y.yaml` to the top of the nav
36+
37+
**nvidia values (both paths)**
38+
The `nvidia_container_toolkit_release` / `nvidia_driver_release` values are resolved
39+
the same way everywhere: first from the `siderolabs/extensions` release notes for the
40+
exact tag, and — if that release is missing, has no nvidia fields, or the fetch fails —
41+
falling back to the current unversioned latest-stable values. They are therefore never
42+
written empty, and a stable run no longer aborts when the extensions data lags behind.
43+
For an existing versioned block, a pre-release only backfills nvidia values that are
44+
currently empty, so good values from an earlier stable run are never overwritten.
45+
46+
The current image tag is matched in full, including any pre-release suffix, so a pin
47+
like `v1.14.0-alpha.2` is replaced cleanly rather than by prefix.
2048

2149
## Usage
2250

23-
From the repo root:
51+
From the repo root, pass the target tag with `TAG=`:
2452

2553
```bash
26-
# Using local Go build
27-
make upgrade-talos-version-local
54+
# Published Docker container
55+
make upgrade-talos-version TAG=v1.14.0-beta.0 # beta of the current minor
56+
make upgrade-talos-version TAG=v1.14.0 # stable
57+
make upgrade-talos-version TAG=v1.15.0-beta.0 # first beta of a new minor
2858

29-
# Using published Docker container
30-
make upgrade-talos-version
59+
# Local Go build
60+
make upgrade-talos-version-local TAG=v1.14.0-beta.0
3161
```
3262

33-
Both commands will prompt you interactively:
63+
After the tool rewrites the pins, the Makefile targets automatically regenerate the
64+
Talos reference docs (`make generate-talos-reference`), the changelog, and
65+
`docs.json`, then tell you to run `make preview` to verify the result.
3466

35-
```
36-
What type of release is this?
37-
[1] Beta - e.g v1.14.0-beta.0
38-
[2] Stable - e.g v1.14.0
67+
Running the binary directly:
3968

40-
Enter your choice (1 or 2):
69+
```bash
70+
go run . --workspace .. --tag v1.14.0-beta.0
4171
```
4272

43-
After the tool runs, it automatically regenerates the changelog and `docs.json`, then tells you to run `make preview` to verify the result.
44-
4573
## Prerequisites
4674

47-
- A `talos-vX.Y.yaml` navigation file must already exist before running in either mode
48-
- For stable releases, a `GITHUB_TOKEN` environment variable is recommended to avoid GitHub API rate limits
75+
- A `talos-vX.Y.yaml` navigation file must already exist before running
76+
- A `GITHUB_TOKEN` is used for the stable release GitHub lookups (and by the
77+
changelog step). The Makefile auto-fills it from `gh auth token` when it isn't
78+
already set in the environment, so no manual export is normally needed.
4979

5080
## Building the container
5181

0 commit comments

Comments
 (0)