Skip to content

Commit 9f8d938

Browse files
shanduursmira
authored andcommitted
fix: print talosctl images to release notes
After changing `talsoctl images k8s-bundle and talos-bundle` we stopped printing some of the images to release notes. This fixes that issue. Signed-off-by: Mateusz Urbanek <mateusz.urbanek@siderolabs.com> (cherry picked from commit 7416dca)
1 parent 95433c1 commit 9f8d938

File tree

4 files changed

+42
-34
lines changed

4 files changed

+42
-34
lines changed

cmd/talosctl/cmd/talos/image.go

Lines changed: 30 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -173,20 +173,13 @@ var imageDefaultCmd = &cobra.Command{
173173
},
174174
}
175175

176-
const (
177-
provisionerDocker = "docker"
178-
provisionerInstaller = "installer"
179-
provisionerAll = "all"
180-
)
181-
182-
var imageDefaultCmdFlags = struct {
183-
provisioner pflag.Value
184-
}{
185-
provisioner: helpers.StringChoice(provisionerInstaller, provisionerDocker, provisionerAll),
186-
}
176+
var imageTalosBundleCmdFlags = struct {
177+
extensions bool
178+
overlays bool
179+
}{}
187180

188-
// imageSourceBundleCmd represents the image talos-bundle command.
189-
var imageSourceBundleCmd = &cobra.Command{
181+
// imageTalosBundleCmd represents the image talos-bundle command.
182+
var imageTalosBundleCmd = &cobra.Command{
190183
Use: "talos-bundle [talos-version]",
191184
Short: "List the default system images and extensions used for Talos",
192185
Long: ``,
@@ -246,16 +239,6 @@ var imageSourceBundleCmd = &cobra.Command{
246239

247240
sources := images.ListSourcesFor(tag)
248241

249-
extensions, err = artifacts.FetchOfficialExtensions(tag)
250-
if err != nil {
251-
return fmt.Errorf("error fetching official extensions for %s: %w", tag, err)
252-
}
253-
254-
overlays, err = artifacts.FetchOfficialOverlays(tag)
255-
if err != nil {
256-
return fmt.Errorf("error fetching official overlays for %s: %w", tag, err)
257-
}
258-
259242
fmt.Printf("%s\n", sources.Installer)
260243
fmt.Printf("%s\n", sources.InstallerBase)
261244
fmt.Printf("%s\n", sources.Imager)
@@ -266,12 +249,26 @@ var imageSourceBundleCmd = &cobra.Command{
266249

267250
digestedReferences := []string{}
268251

269-
for _, overlay := range overlays {
270-
digestedReferences = append(digestedReferences, fmt.Sprintf("%s@%s", overlay.TaggedReference.String(), overlay.Digest))
252+
if imageTalosBundleCmdFlags.extensions {
253+
extensions, err = artifacts.FetchOfficialExtensions(tag)
254+
if err != nil {
255+
return fmt.Errorf("error fetching official extensions for %s: %w", tag, err)
256+
}
257+
258+
for _, extension := range extensions {
259+
digestedReferences = append(digestedReferences, fmt.Sprintf("%s@%s", extension.TaggedReference.String(), extension.Digest))
260+
}
271261
}
272262

273-
for _, extension := range extensions {
274-
digestedReferences = append(digestedReferences, fmt.Sprintf("%s@%s", extension.TaggedReference.String(), extension.Digest))
263+
if imageTalosBundleCmdFlags.overlays {
264+
overlays, err = artifacts.FetchOfficialOverlays(tag)
265+
if err != nil {
266+
return fmt.Errorf("error fetching official overlays for %s: %w", tag, err)
267+
}
268+
269+
for _, overlay := range overlays {
270+
digestedReferences = append(digestedReferences, fmt.Sprintf("%s@%s", overlay.TaggedReference.String(), overlay.Digest))
271+
}
275272
}
276273

277274
slices.Sort(digestedReferences)
@@ -647,12 +644,14 @@ func init() {
647644
imageCmd.PersistentFlags().StringVar(&imageCmdFlags.namespace, "namespace", "cri", "namespace to use: `system` (etcd and kubelet images) or `cri` for all Kubernetes workloads")
648645
addCommand(imageCmd)
649646

650-
imageCmd.AddCommand(imageDefaultCmd)
651-
imageDefaultCmd.PersistentFlags().Var(imageDefaultCmdFlags.provisioner, "provisioner", "include provisioner specific images")
652-
653647
imageCmd.AddCommand(imageListCmd)
654648
imageCmd.AddCommand(imagePullCmd)
655-
imageCmd.AddCommand(imageSourceBundleCmd)
649+
650+
imageCmd.AddCommand(imageTalosBundleCmd)
651+
imageTalosBundleCmd.PersistentFlags().BoolVar(&imageTalosBundleCmdFlags.overlays, "overlays", true, "Include images that belong to Talos overlays")
652+
imageTalosBundleCmd.PersistentFlags().BoolVar(&imageTalosBundleCmdFlags.extensions, "extensions", true, "Include images that belong to Talos extensions")
653+
654+
imageCmd.AddCommand(imageDefaultCmd)
656655

657656
imageCmd.AddCommand(imageCacheCreateCmd)
658657
imageCacheCreateCmd.PersistentFlags().StringVar(&imageCacheCreateCmdFlags.imageCachePath, "image-cache-path", "", "directory to save the image cache in OCI format")

hack/release.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ function release-notes {
2323

2424
echo -e '\n## Images\n\n```' >> ${1}
2525
${ARTIFACTS}/talosctl-linux-amd64 image k8s-bundle >> ${1}
26+
${ARTIFACTS}/talosctl-linux-amd64 image talos-bundle --overlays=false --extensions=false >> ${1}
2627
echo -e '```\n' >> ${1}
2728
}
2829

hack/release.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,13 @@ preface = """
2121
Linux: 6.18.5
2222
2323
Talos is built with Go 1.25.6.
24+
"""
25+
26+
[notes.talosctl_images_talos_bundle]
27+
title = "`talosctl images talos-bundle` can ignore reaching to the registry"
28+
description = """\
29+
The `talosctl images talos-bundle` command now accepts optional `--ovelays` and `--extensions` flags.
30+
If those are set to `false`, the command will not attempt to reach out to the container registry to fetch the latest versions and digests of the overlays and extensions.
2431
"""
2532

2633
[make_deps]

website/content/v1.12/reference/cli.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2211,8 +2211,7 @@ talosctl image k8s-bundle [flags]
22112211
### Options
22122212

22132213
```
2214-
-h, --help help for k8s-bundle
2215-
--provisioner string include provisioner specific images (default "installer")
2214+
-h, --help help for k8s-bundle
22162215
```
22172216

22182217
### Options inherited from parent commands
@@ -2302,7 +2301,9 @@ talosctl image talos-bundle [talos-version] [flags]
23022301
### Options
23032302

23042303
```
2305-
-h, --help help for talos-bundle
2304+
--extensions Include images that belong to Talos extensions (default true)
2305+
-h, --help help for talos-bundle
2306+
--overlays Include images that belong to Talos overlays (default true)
23062307
```
23072308

23082309
### Options inherited from parent commands

0 commit comments

Comments
 (0)