fix(ci): provision tests

Fix the provision-0 cron tests.
Support zstd disk images for `talosctl cluster create`.

Signed-off-by: Noel Georgi <git@frezbo.dev>
This commit is contained in:
Noel Georgi 2025-05-01 19:39:44 +05:30
parent e4945be3bc
commit 01bb294af6
No known key found for this signature in database
GPG Key ID: 21A9F444075C9E36
8 changed files with 60 additions and 16 deletions

View File

@ -1,6 +1,6 @@
# THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT.
#
# Generated on 2025-04-15T15:57:38Z by kres fd5cab0.
# Generated on 2025-05-01T14:09:23Z by kres 6cbcbd1.
name: default
concurrency:
@ -2998,6 +2998,14 @@ jobs:
if: github.event_name == 'schedule'
run: |
make talosctl-cni-bundle
- name: images-essential
if: github.event_name == 'schedule'
env:
IMAGE_REGISTRY: registry.dev.siderolabs.io
IMAGER_ARGS: --extra-kernel-arg=console=ttyS0
PLATFORM: linux/amd64,linux/arm64
run: |
make images-essential
- name: provision-tests-prepare
run: |
make provision-tests-prepare

View File

@ -1,6 +1,6 @@
# THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT.
#
# Generated on 2025-04-01T08:14:24Z by kres d903dae.
# Generated on 2025-05-01T14:09:23Z by kres 6cbcbd1.
name: integration-provision-0-cron
concurrency:
@ -78,6 +78,14 @@ jobs:
if: github.event_name == 'schedule'
run: |
make talosctl-cni-bundle
- name: images-essential
if: github.event_name == 'schedule'
env:
IMAGE_REGISTRY: registry.dev.siderolabs.io
IMAGER_ARGS: --extra-kernel-arg=console=ttyS0
PLATFORM: linux/amd64,linux/arm64
run: |
make images-essential
- name: provision-tests-prepare
run: |
make provision-tests-prepare

View File

@ -731,6 +731,13 @@ spec:
- name: talosctl-cni-bundle
conditions:
- only-on-schedule
- name: images-essential
conditions:
- only-on-schedule
environment:
PLATFORM: linux/amd64,linux/arm64
IMAGER_ARGS: "--extra-kernel-arg=console=ttyS0"
IMAGE_REGISTRY: registry.dev.siderolabs.io
- name: provision-tests-prepare
- name: provision-tests-track-0
withSudo: true

View File

@ -246,6 +246,8 @@ func downloadBootAssets(ctx context.Context) error {
},
{
path: &nodeDiskImagePath,
// we disable extracting the compressed image since we handle zstd for disk images
disableArchive: true,
},
} {
if *downloadableImage.path == "" {

View File

@ -106,8 +106,7 @@ case "${USE_DISK_IMAGE:-false}" in
false)
;;
*)
zstd -d < _out/metal-amd64.raw.zst > _out/metal-amd64.raw
QEMU_FLAGS+=("--disk-image-path=_out/metal-amd64.raw")
QEMU_FLAGS+=("--disk-image-path=_out/metal-amd64.raw.zst")
;;
esac

View File

@ -39,8 +39,6 @@ case "${CUSTOM_CNI_URL:-false}" in
;;
esac
zstd -d < _out/metal-amd64.raw.zst > _out/metal-amd64.raw
"${INTEGRATION_TEST}" -test.v \
-talos.talosctlpath "${TALOSCTL}" \
-talos.provision.mtu 1430 \

View File

@ -147,7 +147,7 @@ func upgradeCurrentToCurrentBios() upgradeSpec {
return upgradeSpec{
ShortName: fmt.Sprintf("%s-same-ver-bios", DefaultSettings.CurrentVersion),
SourceDiskImagePath: helpers.ArtifactPath("metal-amd64.raw"),
SourceDiskImagePath: helpers.ArtifactPath("metal-amd64.raw.zst"),
SourceInstallerImage: installerImage,
SourceVersion: DefaultSettings.CurrentVersion,
SourceK8sVersion: currentK8sVersion,

View File

@ -19,6 +19,7 @@ import (
"github.com/google/uuid"
"github.com/hashicorp/go-multierror"
"github.com/klauspost/compress/zstd"
"github.com/siderolabs/gen/xslices"
"github.com/siderolabs/go-cmd/pkg/cmd"
"github.com/siderolabs/go-procfs/procfs"
@ -317,24 +318,45 @@ func (p *provisioner) findBridgeListenPort(clusterReq provision.ClusterRequest)
func (p *provisioner) populateSystemDisk(disks []string, clusterReq provision.ClusterRequest) error {
if len(disks) > 0 && clusterReq.DiskImagePath != "" {
disk, err := os.OpenFile(disks[0], os.O_RDWR, 0o755)
if err := p.handleOptionalZSTDDiskImage(disks[0], clusterReq.DiskImagePath); err != nil {
return err
}
}
return nil
}
func (p *provisioner) handleOptionalZSTDDiskImage(provisionerDisk, diskImagePath string) error {
image, err := os.Open(diskImagePath)
if err != nil {
return err
}
defer image.Close() //nolint:errcheck
disk, err := os.OpenFile(provisionerDisk, os.O_RDWR, 0o755)
if err != nil {
return err
}
defer disk.Close() //nolint:errcheck
if strings.HasSuffix(diskImagePath, ".zst") {
zstdReader, err := zstd.NewReader(image)
if err != nil {
return err
}
defer disk.Close() //nolint:errcheck
image, err := os.Open(clusterReq.DiskImagePath)
if err != nil {
return err
}
defer image.Close() //nolint:errcheck
defer zstdReader.Close() //nolint:errcheck
_, err = io.Copy(disk, image)
_, err = io.Copy(disk, zstdReader)
return err
}
return nil
_, err = io.Copy(disk, image)
return err
}
func (p *provisioner) createMetalConfigISO(state *vm.State, nodeName, config string) (string, error) {