Skip to content

Validate arch against image not default #1745

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions examples/experimental/riscv64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
arch: "riscv64"
images:
- location: "https://cloud-images.ubuntu.com/releases/23.04/release-20230810/ubuntu-23.04-server-cloudimg-riscv64.img"
arch: "riscv64"
digest: "sha256:d9f56eac9c644f78353154d9f17e1ce739d7c63beac63ccefe2380b2f2e9aa38"
kernel:
# Extracted from http://http.us.debian.org/debian/pool/main/u/u-boot/u-boot-qemu_2023.01+dfsg-2_all.deb (GPL-2.0)
Expand All @@ -11,6 +12,7 @@ images:
# Fallback to the latest release image.
# Hint: run `limactl prune` to invalidate the cache
- location: "https://cloud-images.ubuntu.com/releases/23.04/release/ubuntu-23.04-server-cloudimg-riscv64.img"
arch: "riscv64"
kernel:
# Extracted from http://http.us.debian.org/debian/pool/main/u/u-boot/u-boot-qemu_2023.04+dfsg-1_all.deb (GPL-2.0)
location: "https://github.com/lima-vm/u-boot-qemu-mirror/releases/download/2023.04%2Bdfsg-1/qemu-riscv64_smode_uboot.elf"
Expand Down
8 changes: 4 additions & 4 deletions pkg/limayaml/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ func Validate(y LimaYAML, warn bool) error {
if err := validateFileObject(f.Kernel.File, fmt.Sprintf("images[%d].kernel", i)); err != nil {
return err
}
if f.Kernel.Arch != *y.Arch {
return fmt.Errorf("images[%d].kernel has unexpected architecture %q, must be %q", i, f.Kernel.Arch, *y.Arch)
if f.Kernel.Arch != f.Arch {
return fmt.Errorf("images[%d].kernel has unexpected architecture %q, must be %q", i, f.Kernel.Arch, f.Arch)
}
} else if f.Arch == RISCV64 {
return errors.New("riscv64 needs the kernel (e.g., \"uboot.elf\") to be specified")
Expand All @@ -88,8 +88,8 @@ func Validate(y LimaYAML, warn bool) error {
if f.Kernel == nil {
return errors.New("initrd requires the kernel to be specified")
}
if f.Initrd.Arch != *y.Arch {
return fmt.Errorf("images[%d].initrd has unexpected architecture %q, must be %q", i, f.Initrd.Arch, *y.Arch)
if f.Initrd.Arch != f.Arch {
return fmt.Errorf("images[%d].initrd has unexpected architecture %q, must be %q", i, f.Initrd.Arch, f.Arch)
}
}
}
Expand Down