mirror of
https://github.com/MengMengCode/CLICD.git
synced 2026-08-05 05:36:07 +08:00
80 lines
2.6 KiB
Go
80 lines
2.6 KiB
Go
package kvm
|
|
|
|
import (
|
|
"path/filepath"
|
|
)
|
|
|
|
type Image struct {
|
|
ID string `json:"id"`
|
|
Name string `json:"name"`
|
|
Distro string `json:"distro"`
|
|
Release string `json:"release"`
|
|
Arch string `json:"arch"`
|
|
Description string `json:"description"`
|
|
URL string `json:"url"`
|
|
}
|
|
|
|
func GetImages() []Image {
|
|
return []Image{
|
|
{
|
|
ID: "kvm-ubuntu-noble", Name: "Ubuntu 24.04 KVM",
|
|
Distro: "ubuntu", Release: "noble", Arch: "amd64",
|
|
Description: "Ubuntu 24.04 LTS cloud image for KVM",
|
|
URL: "https://cloud-images.ubuntu.com/noble/current/noble-server-cloudimg-amd64.img",
|
|
},
|
|
{
|
|
ID: "kvm-ubuntu-jammy", Name: "Ubuntu 22.04 KVM",
|
|
Distro: "ubuntu", Release: "jammy", Arch: "amd64",
|
|
Description: "Ubuntu 22.04 LTS cloud image for KVM",
|
|
URL: "https://cloud-images.ubuntu.com/jammy/current/jammy-server-cloudimg-amd64.img",
|
|
},
|
|
{
|
|
ID: "kvm-debian-bookworm", Name: "Debian 12 KVM",
|
|
Distro: "debian", Release: "bookworm", Arch: "amd64",
|
|
Description: "Debian 12 generic cloud image for KVM",
|
|
URL: "https://cloud.debian.org/images/cloud/bookworm/latest/debian-12-genericcloud-amd64.qcow2",
|
|
},
|
|
{
|
|
ID: "kvm-debian-bullseye", Name: "Debian 11 KVM",
|
|
Distro: "debian", Release: "bullseye", Arch: "amd64",
|
|
Description: "Debian 11 generic cloud image for KVM",
|
|
URL: "https://cloud.debian.org/images/cloud/bullseye/latest/debian-11-genericcloud-amd64.qcow2",
|
|
},
|
|
{
|
|
ID: "kvm-rockylinux-9", Name: "Rocky Linux 9 KVM",
|
|
Distro: "rockylinux", Release: "9", Arch: "amd64",
|
|
Description: "Rocky Linux 9 GenericCloud image for KVM",
|
|
URL: "https://dl.rockylinux.org/pub/rocky/9/images/x86_64/Rocky-9-GenericCloud-Base.latest.x86_64.qcow2",
|
|
},
|
|
{
|
|
ID: "kvm-centos-9-stream", Name: "CentOS Stream 9 KVM",
|
|
Distro: "centos", Release: "9-stream", Arch: "amd64",
|
|
Description: "CentOS Stream 9 GenericCloud image for KVM",
|
|
URL: "https://cloud.centos.org/centos/9-stream/x86_64/images/CentOS-Stream-GenericCloud-9-latest.x86_64.qcow2",
|
|
},
|
|
{
|
|
ID: "kvm-alpine-3.23", Name: "Alpine 3.23 KVM",
|
|
Distro: "alpine", Release: "3.23", Arch: "amd64",
|
|
Description: "Alpine Linux 3.23 NoCloud cloud-init image for KVM",
|
|
URL: "https://dev.alpinelinux.org/~tomalok/alpine-cloud-images/v3.23/nocloud/x86_64/nocloud_alpine-3.23.4-x86_64-bios-cloudinit-r0.qcow2",
|
|
},
|
|
}
|
|
}
|
|
|
|
func FindImage(id string) *Image {
|
|
for _, image := range GetImages() {
|
|
if image.ID == id {
|
|
return &image
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func CacheDir() string {
|
|
return filepath.Join(BaseDir(), "images")
|
|
}
|
|
|
|
func ImagePath(id string) string {
|
|
return filepath.Join(CacheDir(), id+".qcow2")
|
|
}
|