Skip to content

Commit 524e136

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

5 files changed

Lines changed: 388 additions & 191 deletions

File tree

Makefile

Lines changed: 40 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,14 @@ 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+
# `export` makes it visible to recipe subprocesses (e.g. the local `go run` targets),
23+
# not just to the containers that pass it explicitly with `-e`.
24+
GITHUB_TOKEN ?= $(shell gh auth token 2>/dev/null)
25+
export GITHUB_TOKEN
26+
1927
# Default target
2028
.PHONY: help
2129
help: ## Show this help message
@@ -331,29 +339,53 @@ changelog-local: ## Generate the changelog using local Go build
331339
validate-docs-nav: ## Validate all talos yaml nav configs match their content directories
332340
cd docs-validate && go run . --workspace ..
333341

342+
# validate-tag distinguishes the two ways a TAG can be wrong, with a tailored
343+
# message for each, and fails BEFORE the generator writes anything:
344+
# 1. malformed -> show the expected format and examples
345+
# 2. unpublished -> the format is fine but no talosctl image exists for it yet
346+
define validate-tag
347+
@echo "$(TAG)" | grep -Eq '^v[0-9]+\.[0-9]+\.[0-9]+(-(alpha|beta|rc)\.[0-9]+)?$$' || { \
348+
echo "Error: malformed TAG '$(TAG)'."; \
349+
echo " Expected: vMAJOR.MINOR.PATCH with an optional -alpha.N / -beta.N / -rc.N suffix."; \
350+
echo " Examples: v1.14.0 v1.14.0-alpha.0 v1.14.0-beta.2 v1.14.0-rc.1"; \
351+
exit 1; }
352+
@docker manifest inspect ghcr.io/siderolabs/talosctl:$(TAG) >/dev/null 2>&1 || { \
353+
echo "Error: TAG '$(TAG)' is well-formed but not published yet."; \
354+
echo " No image 'ghcr.io/siderolabs/talosctl:$(TAG)' was found in the registry."; \
355+
echo " The release may not be cut yet — see https://github.com/siderolabs/talos/releases"; \
356+
echo " Pass a TAG whose talosctl image already exists."; \
357+
exit 1; }
358+
endef
359+
334360
.PHONY: upgrade-talos-version
335-
upgrade-talos-version: ## Upgrade docs to the next Talos minor version (fetches versions from GitHub)
361+
upgrade-talos-version: ## Upgrade Talos docs to a release tag: make upgrade-talos-version TAG=v1.14.0-beta.0
362+
@test -n "$(TAG)" || { echo "Error: TAG is required, e.g. make upgrade-talos-version TAG=v1.14.0-beta.0"; exit 1; }
363+
$(validate-tag)
336364
docker run --rm -it -v $(PWD):/workspace -w /workspace \
337365
-e GITHUB_TOKEN=$(GITHUB_TOKEN) \
338-
$(VERSION_UPGRADE_IMAGE)
339-
$(eval NEW_VERSION := $(shell cat .upgrade-version-tmp))
366+
$(VERSION_UPGRADE_IMAGE) --tag $(TAG)
367+
$(eval NEW_VERSION := $(shell cat .upgrade-version-tmp 2>/dev/null))
340368
@rm -f .upgrade-version-tmp
369+
$(MAKE) generate-talos-reference
341370
$(MAKE) changelog
342371
$(MAKE) docs.json
343372
$(MAKE) validate-docs-nav
344373
@echo ""
345-
@echo "Upgrade to $(NEW_VERSION) complete! Run: make preview to preview your $(NEW_VERSION) docs"
374+
@echo "Upgrade to $(TAG) complete! Run: make preview to preview your $(NEW_VERSION) docs"
346375

347376
.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))
377+
upgrade-talos-version-local: ## Same as upgrade-talos-version but using the local Go build
378+
@test -n "$(TAG)" || { echo "Error: TAG is required, e.g. make upgrade-talos-version-local TAG=v1.14.0-beta.0"; exit 1; }
379+
$(validate-tag)
380+
cd version-upgrade-gen && go run . --workspace .. --tag $(TAG)
381+
$(eval NEW_VERSION := $(shell cat .upgrade-version-tmp 2>/dev/null))
351382
@rm -f .upgrade-version-tmp
383+
$(MAKE) generate-talos-reference-local
352384
$(MAKE) changelog
353385
$(MAKE) docs.json
354386
$(MAKE) validate-docs-nav
355387
@echo ""
356-
@echo "Upgrade to $(NEW_VERSION) complete! Run: make preview to preview your $(NEW_VERSION) docs"
388+
@echo "Upgrade to $(TAG) complete! Run: make preview to preview your $(NEW_VERSION) docs"
357389

358390
.PHONY: build-version-upgrade-container
359391
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-

public/talos/v1.14/reference/cli.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ talosctl cluster create dev [flags]
134134

135135
```
136136
--airgapped limit VM network access to the provisioning network only
137-
--arch string cluster architecture (default "amd64")
137+
--arch string cluster architecture (default "arm64")
138138
--bad-rtc launch VM with bad RTC state
139139
--cidr string CIDR of the cluster network (IPv4, ULA network for IPv6 is derived in automated way) (default "10.5.0.0/24")
140140
--cni-bin-path strings search path for CNI binaries (default [/.talos/cni/bin])
@@ -352,7 +352,7 @@ talosctl cluster create dev [flags]
352352

353353
```
354354
--airgapped limit VM network access to the provisioning network only
355-
--arch string cluster architecture (default "amd64")
355+
--arch string cluster architecture (default "arm64")
356356
--bad-rtc launch VM with bad RTC state
357357
--cidr string CIDR of the cluster network (IPv4, ULA network for IPv6 is derived in automated way) (default "10.5.0.0/24")
358358
--cni-bin-path strings search path for CNI binaries (default [/.talos/cni/bin])

version-upgrade-gen/README.md

Lines changed: 66 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,89 @@
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.
73+
## Tag validation
74+
75+
The `--tag` value must be `vMAJOR.MINOR.PATCH` with an optional `-alpha.N` /
76+
`-beta.N` / `-rc.N` suffix (e.g. `v1.14.0`, `v1.14.0-beta.0`). Surrounding
77+
whitespace is trimmed. Anything else — a missing `v`, a missing patch number, a
78+
misspelled stage, etc. — is rejected up front, before any file is modified, so a
79+
typo can never leave the repo in a half-applied state.
4480

4581
## Prerequisites
4682

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
83+
- A `talos-vX.Y.yaml` navigation file must already exist before running
84+
- A `GITHUB_TOKEN` is used for the stable release GitHub lookups (and by the
85+
changelog step). The Makefile auto-fills it from `gh auth token` when it isn't
86+
already set in the environment, so no manual export is normally needed.
4987

5088
## Building the container
5189

0 commit comments

Comments
 (0)