mirror of
https://github.com/containers/podman.git
synced 2025-07-04 01:48:28 +08:00
Prune FCOS related code
Given the switch to pulling oci artifacts for podman, we no longer need a fair bit of fedora coreos code for automatically downloading images. [NO NEW TESTS NEEDED] Signed-off-by: Brent Baude <bbaude@redhat.com>
This commit is contained in:
@ -6,11 +6,6 @@ import (
|
|||||||
"os/exec"
|
"os/exec"
|
||||||
)
|
)
|
||||||
|
|
||||||
// TODO temporarily suspended
|
|
||||||
// func getDownloadLocation(p machine.VirtProvider) string {
|
|
||||||
// return getFCOSDownloadLocation(p)
|
|
||||||
// }
|
|
||||||
|
|
||||||
func pgrep(n string) (string, error) {
|
func pgrep(n string) (string, error) {
|
||||||
out, err := exec.Command("pgrep", "gvproxy").Output()
|
out, err := exec.Command("pgrep", "gvproxy").Output()
|
||||||
return string(out), err
|
return string(out), err
|
||||||
|
@ -30,7 +30,6 @@ func TestMain(m *testing.M) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
defaultStream = machine.Testing
|
|
||||||
defaultDiskSize uint = 11
|
defaultDiskSize uint = 11
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -75,7 +74,7 @@ var _ = BeforeSuite(func() {
|
|||||||
default:
|
default:
|
||||||
downloadLocation, err = GetDownload(testProvider.VMType())
|
downloadLocation, err = GetDownload(testProvider.VMType())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
Fail("unable to derive download disk from fedora coreos")
|
Fail(fmt.Sprintf("unable to derive download disk from fedora coreos: %q", err))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,9 +5,10 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"runtime"
|
||||||
|
|
||||||
"github.com/containers/podman/v5/pkg/machine"
|
|
||||||
"github.com/containers/podman/v5/pkg/machine/define"
|
"github.com/containers/podman/v5/pkg/machine/define"
|
||||||
|
"github.com/containers/podman/v5/pkg/machine/vmconfigs"
|
||||||
"github.com/coreos/stream-metadata-go/fedoracoreos"
|
"github.com/coreos/stream-metadata-go/fedoracoreos"
|
||||||
"github.com/coreos/stream-metadata-go/stream"
|
"github.com/coreos/stream-metadata-go/stream"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
@ -49,11 +50,15 @@ func GetDownload(vmType define.VMType) (string, error) {
|
|||||||
format = "qcow2.xz"
|
format = "qcow2.xz"
|
||||||
}
|
}
|
||||||
|
|
||||||
arch, ok := fcosstable.Architectures[machine.GetFcosArch()]
|
arch, err := vmconfigs.NormalizeMachineArch(runtime.GOARCH)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
fcosArch, ok := fcosstable.Architectures[arch]
|
||||||
if !ok {
|
if !ok {
|
||||||
return "", fmt.Errorf("unable to pull VM image: no targetArch in stream")
|
return "", fmt.Errorf("unable to pull VM image: no targetArch in stream")
|
||||||
}
|
}
|
||||||
upstreamArtifacts := arch.Artifacts
|
upstreamArtifacts := fcosArch.Artifacts
|
||||||
if upstreamArtifacts == nil {
|
if upstreamArtifacts == nil {
|
||||||
return "", fmt.Errorf("unable to pull VM image: no artifact in stream")
|
return "", fmt.Errorf("unable to pull VM image: no artifact in stream")
|
||||||
}
|
}
|
||||||
|
@ -1,239 +0,0 @@
|
|||||||
//go:build amd64 || arm64
|
|
||||||
|
|
||||||
package machine
|
|
||||||
|
|
||||||
import (
|
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
|
||||||
"io"
|
|
||||||
"net/http"
|
|
||||||
url2 "net/url"
|
|
||||||
"os"
|
|
||||||
"runtime"
|
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/containers/podman/v5/pkg/machine/compression"
|
|
||||||
"github.com/containers/podman/v5/pkg/machine/define"
|
|
||||||
"github.com/coreos/stream-metadata-go/fedoracoreos"
|
|
||||||
"github.com/coreos/stream-metadata-go/release"
|
|
||||||
"github.com/coreos/stream-metadata-go/stream"
|
|
||||||
"github.com/opencontainers/go-digest"
|
|
||||||
"github.com/sirupsen/logrus"
|
|
||||||
)
|
|
||||||
|
|
||||||
const (
|
|
||||||
// Used for testing the latest podman in fcos
|
|
||||||
// special builds
|
|
||||||
PodmanTestingHost = "fedorapeople.org"
|
|
||||||
PodmanTestingURL = "groups/podman/testing"
|
|
||||||
)
|
|
||||||
|
|
||||||
//
|
|
||||||
// TODO artifact, imageformat, and imagecompression should be probably combined into some sort
|
|
||||||
// of object which can "produce" the correct output we are looking for bc things like
|
|
||||||
// image format contain both the image type AND the compression. This work can be done before
|
|
||||||
// or after the hyperv work. For now, my preference is to NOT change things and just get things
|
|
||||||
// typed strongly
|
|
||||||
//
|
|
||||||
|
|
||||||
type FcosDownload struct {
|
|
||||||
Download
|
|
||||||
}
|
|
||||||
|
|
||||||
func (f FcosDownload) Get() *Download {
|
|
||||||
return &f.Download
|
|
||||||
}
|
|
||||||
|
|
||||||
type FcosDownloadInfo struct {
|
|
||||||
CompressionType compression.ImageCompression
|
|
||||||
Location string
|
|
||||||
Release string
|
|
||||||
Sha256Sum string
|
|
||||||
}
|
|
||||||
|
|
||||||
func (f FcosDownload) HasUsableCache() (bool, error) {
|
|
||||||
// check the sha of the local image if it exists
|
|
||||||
// get the sha of the remote image
|
|
||||||
// == do not bother to pull
|
|
||||||
if _, err := os.Stat(f.LocalPath); os.IsNotExist(err) {
|
|
||||||
return false, nil
|
|
||||||
}
|
|
||||||
fd, err := os.Open(f.LocalPath)
|
|
||||||
if err != nil {
|
|
||||||
return false, err
|
|
||||||
}
|
|
||||||
defer func() {
|
|
||||||
if err := fd.Close(); err != nil {
|
|
||||||
logrus.Error(err)
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
sum, err := digest.SHA256.FromReader(fd)
|
|
||||||
if err != nil {
|
|
||||||
return false, err
|
|
||||||
}
|
|
||||||
return sum.Encoded() == f.Sha256sum, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (f FcosDownload) CleanCache() error {
|
|
||||||
// Set cached image to expire after 2 weeks
|
|
||||||
// FCOS refreshes around every 2 weeks, assume old images aren't needed
|
|
||||||
expire := 14 * 24 * time.Hour
|
|
||||||
return RemoveImageAfterExpire(f.CacheDir, expire)
|
|
||||||
}
|
|
||||||
|
|
||||||
func GetFcosArch() string {
|
|
||||||
var arch string
|
|
||||||
// TODO fill in more architectures
|
|
||||||
switch runtime.GOARCH {
|
|
||||||
case "arm64":
|
|
||||||
arch = "aarch64"
|
|
||||||
case "riscv64":
|
|
||||||
arch = "riscv64"
|
|
||||||
default:
|
|
||||||
arch = "x86_64"
|
|
||||||
}
|
|
||||||
return arch
|
|
||||||
}
|
|
||||||
|
|
||||||
// getStreamURL is a wrapper for the fcos.GetStream URL
|
|
||||||
// so that we can inject a special stream and url for
|
|
||||||
// testing podman before it merges into fcos builds
|
|
||||||
func getStreamURL(streamType FCOSStream) url2.URL {
|
|
||||||
// For the podmanTesting stream type, we point to
|
|
||||||
// a custom url on fedorapeople.org
|
|
||||||
if streamType == PodmanTesting {
|
|
||||||
return url2.URL{
|
|
||||||
Scheme: "https",
|
|
||||||
Host: PodmanTestingHost,
|
|
||||||
Path: fmt.Sprintf("%s/%s.json", PodmanTestingURL, "podman4"),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return fedoracoreos.GetStreamURL(streamType.String())
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetFCOSDownload parses fedoraCoreOS's stream and returns the image download URL and the release version
|
|
||||||
func (dl Download) GetFCOSDownload(imageStream FCOSStream) (*FcosDownloadInfo, error) {
|
|
||||||
var (
|
|
||||||
fcosstable stream.Stream
|
|
||||||
altMeta release.Release
|
|
||||||
)
|
|
||||||
|
|
||||||
streamurl := getStreamURL(imageStream)
|
|
||||||
resp, err := http.Get(streamurl.String())
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
body, err := io.ReadAll(resp.Body)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
defer func() {
|
|
||||||
if err := resp.Body.Close(); err != nil {
|
|
||||||
logrus.Error(err)
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
if imageStream == PodmanTesting {
|
|
||||||
if err := json.Unmarshal(body, &altMeta); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
arches, ok := altMeta.Architectures[GetFcosArch()]
|
|
||||||
if !ok {
|
|
||||||
return nil, fmt.Errorf("unable to pull VM image: no targetArch in stream")
|
|
||||||
}
|
|
||||||
qcow2, ok := arches.Media.Qemu.Artifacts[define.Qcow.KindWithCompression()]
|
|
||||||
if !ok {
|
|
||||||
return nil, fmt.Errorf("unable to pull VM image: no qcow2.xz format in stream")
|
|
||||||
}
|
|
||||||
disk := qcow2.Disk
|
|
||||||
|
|
||||||
return &FcosDownloadInfo{
|
|
||||||
Location: disk.Location,
|
|
||||||
Sha256Sum: disk.Sha256,
|
|
||||||
CompressionType: dl.CompressionType,
|
|
||||||
}, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := json.Unmarshal(body, &fcosstable); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
arch, ok := fcosstable.Architectures[GetFcosArch()]
|
|
||||||
if !ok {
|
|
||||||
return nil, fmt.Errorf("unable to pull VM image: no targetArch in stream")
|
|
||||||
}
|
|
||||||
upstreamArtifacts := arch.Artifacts
|
|
||||||
if upstreamArtifacts == nil {
|
|
||||||
return nil, fmt.Errorf("unable to pull VM image: no artifact in stream")
|
|
||||||
}
|
|
||||||
upstreamArtifact, ok := upstreamArtifacts[dl.Artifact.String()]
|
|
||||||
if !ok {
|
|
||||||
return nil, fmt.Errorf("unable to pull VM image: no %s artifact in stream", dl.Artifact.String())
|
|
||||||
}
|
|
||||||
formats := upstreamArtifact.Formats
|
|
||||||
if formats == nil {
|
|
||||||
return nil, fmt.Errorf("unable to pull VM image: no formats in stream")
|
|
||||||
}
|
|
||||||
formatType, ok := formats[dl.Format.KindWithCompression()]
|
|
||||||
if !ok {
|
|
||||||
return nil, fmt.Errorf("unable to pull VM image: no %s format in stream", dl.Format.KindWithCompression())
|
|
||||||
}
|
|
||||||
disk := formatType.Disk
|
|
||||||
if disk == nil {
|
|
||||||
return nil, fmt.Errorf("unable to pull VM image: no disk in stream")
|
|
||||||
}
|
|
||||||
return &FcosDownloadInfo{
|
|
||||||
Location: disk.Location,
|
|
||||||
Release: upstreamArtifact.Release,
|
|
||||||
Sha256Sum: disk.Sha256,
|
|
||||||
CompressionType: dl.CompressionType,
|
|
||||||
}, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
type FCOSStream int64
|
|
||||||
|
|
||||||
const (
|
|
||||||
// FCOS streams
|
|
||||||
// Testing FCOS stream
|
|
||||||
Testing FCOSStream = iota
|
|
||||||
// Next FCOS stream
|
|
||||||
Next
|
|
||||||
// Stable FCOS stream
|
|
||||||
Stable
|
|
||||||
// Podman-Testing
|
|
||||||
PodmanTesting
|
|
||||||
// Custom
|
|
||||||
CustomStream
|
|
||||||
)
|
|
||||||
|
|
||||||
// String is a helper func for fcos streams
|
|
||||||
func (st FCOSStream) String() string {
|
|
||||||
switch st {
|
|
||||||
case Testing:
|
|
||||||
return "testing"
|
|
||||||
case Next:
|
|
||||||
return "next"
|
|
||||||
case PodmanTesting:
|
|
||||||
return "podman-testing"
|
|
||||||
case Stable:
|
|
||||||
return "stable"
|
|
||||||
}
|
|
||||||
return "custom"
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO can be removed when WSL is refactored into podman 5
|
|
||||||
func IsValidFCOSStreamString(s string) bool {
|
|
||||||
switch s {
|
|
||||||
case Testing.String():
|
|
||||||
fallthrough
|
|
||||||
case Next.String():
|
|
||||||
fallthrough
|
|
||||||
case PodmanTesting.String():
|
|
||||||
fallthrough
|
|
||||||
case Stable.String():
|
|
||||||
return true
|
|
||||||
case CustomStream.String():
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
return false
|
|
||||||
}
|
|
@ -1,43 +0,0 @@
|
|||||||
//go:build amd64 || arm64
|
|
||||||
|
|
||||||
package machine
|
|
||||||
|
|
||||||
import (
|
|
||||||
"testing"
|
|
||||||
)
|
|
||||||
|
|
||||||
func TestFCOSStream_String(t *testing.T) {
|
|
||||||
tests := []struct {
|
|
||||||
name string
|
|
||||||
st FCOSStream
|
|
||||||
want string
|
|
||||||
}{
|
|
||||||
{
|
|
||||||
name: "testing",
|
|
||||||
st: Testing,
|
|
||||||
want: "testing",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "stable",
|
|
||||||
st: Stable,
|
|
||||||
want: "stable",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "next",
|
|
||||||
st: Next,
|
|
||||||
want: "next",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "default is custom",
|
|
||||||
st: CustomStream,
|
|
||||||
want: "custom",
|
|
||||||
},
|
|
||||||
}
|
|
||||||
for _, tt := range tests {
|
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
|
||||||
if got := tt.st.String(); got != tt.want {
|
|
||||||
t.Errorf("String() = %v, want %v", got, tt.want)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
@ -231,61 +231,3 @@ func isOci(input string) (bool, *ocipull.OCIKind, error) { //nolint:unused
|
|||||||
}
|
}
|
||||||
return false, nil, nil
|
return false, nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// func Pull(input, machineName string, vp VirtProvider) (*define.VMFile, FCOSStream, error) {
|
|
||||||
// var (
|
|
||||||
// disk ocipull.Disker
|
|
||||||
// )
|
|
||||||
//
|
|
||||||
// ociBased, ociScheme, err := isOci(input)
|
|
||||||
// if err != nil {
|
|
||||||
// return nil, 0, err
|
|
||||||
// }
|
|
||||||
// if !ociBased {
|
|
||||||
// // Business as usual
|
|
||||||
// dl, err := vp.NewDownload(machineName)
|
|
||||||
// if err != nil {
|
|
||||||
// return nil, 0, err
|
|
||||||
// }
|
|
||||||
// return dl.AcquireVMImage(input)
|
|
||||||
// }
|
|
||||||
// oopts := ocipull.OCIOpts{
|
|
||||||
// Scheme: ociScheme,
|
|
||||||
// }
|
|
||||||
// dataDir, err := GetDataDir(vp.VMType())
|
|
||||||
// if err != nil {
|
|
||||||
// return nil, 0, err
|
|
||||||
// }
|
|
||||||
// if ociScheme.IsOCIDir() {
|
|
||||||
// strippedOCIDir := ocipull.StripOCIReference(input)
|
|
||||||
// oopts.Dir = &strippedOCIDir
|
|
||||||
// disk = ocipull.NewOCIDir(context.Background(), input, dataDir, machineName)
|
|
||||||
// } else {
|
|
||||||
// // a use of a containers image type here might be
|
|
||||||
// // tighter
|
|
||||||
// strippedInput := strings.TrimPrefix(input, "docker://")
|
|
||||||
// // this is the next piece of work
|
|
||||||
// if len(strippedInput) > 0 {
|
|
||||||
// return nil, 0, errors.New("image names are not supported yet")
|
|
||||||
// }
|
|
||||||
// disk, err = ocipull.NewVersioned(context.Background(), dataDir, machineName, vp.VMType().String())
|
|
||||||
// if err != nil {
|
|
||||||
// return nil, 0, err
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// if err := disk.Pull(); err != nil {
|
|
||||||
// return nil, 0, err
|
|
||||||
// }
|
|
||||||
// unpacked, err := disk.Unpack()
|
|
||||||
// if err != nil {
|
|
||||||
// return nil, 0, err
|
|
||||||
// }
|
|
||||||
// defer func() {
|
|
||||||
// logrus.Debugf("cleaning up %q", unpacked.GetPath())
|
|
||||||
// if err := unpacked.Delete(); err != nil {
|
|
||||||
// logrus.Errorf("unable to delete local compressed file %q:%v", unpacked.GetPath(), err)
|
|
||||||
// }
|
|
||||||
// }()
|
|
||||||
// imagePath, err := disk.Decompress(unpacked)
|
|
||||||
// return imagePath, UnknownStream, err
|
|
||||||
//}
|
|
||||||
|
15
pkg/machine/vmconfigs/arch.go
Normal file
15
pkg/machine/vmconfigs/arch.go
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
package vmconfigs
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
)
|
||||||
|
|
||||||
|
func NormalizeMachineArch(arch string) (string, error) {
|
||||||
|
switch arch {
|
||||||
|
case "arm64", "aarch64":
|
||||||
|
return "aarch64", nil
|
||||||
|
case "x86_64", "amd64":
|
||||||
|
return "x86_64", nil
|
||||||
|
}
|
||||||
|
return "", fmt.Errorf("unsupported platform %s", arch)
|
||||||
|
}
|
68
pkg/machine/vmconfigs/arch_test.go
Normal file
68
pkg/machine/vmconfigs/arch_test.go
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
package vmconfigs
|
||||||
|
|
||||||
|
import "testing"
|
||||||
|
|
||||||
|
func TestNormalizeMachineArch(t *testing.T) {
|
||||||
|
type args struct {
|
||||||
|
arch string
|
||||||
|
}
|
||||||
|
var tests = []struct {
|
||||||
|
name string
|
||||||
|
args args
|
||||||
|
want string
|
||||||
|
wantErr bool
|
||||||
|
}{
|
||||||
|
{
|
||||||
|
name: "x86_64",
|
||||||
|
args: args{
|
||||||
|
arch: "x86_64",
|
||||||
|
},
|
||||||
|
want: "x86_64",
|
||||||
|
wantErr: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "amd64",
|
||||||
|
args: args{
|
||||||
|
arch: "amd64",
|
||||||
|
},
|
||||||
|
want: "x86_64",
|
||||||
|
wantErr: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "aarch64",
|
||||||
|
args: args{
|
||||||
|
arch: "aarch64",
|
||||||
|
},
|
||||||
|
want: "aarch64",
|
||||||
|
wantErr: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "arm64",
|
||||||
|
args: args{
|
||||||
|
arch: "arm64",
|
||||||
|
},
|
||||||
|
want: "aarch64",
|
||||||
|
wantErr: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "Unknown arch should fail",
|
||||||
|
args: args{
|
||||||
|
arch: "foobar",
|
||||||
|
},
|
||||||
|
want: "",
|
||||||
|
wantErr: true,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
for _, tt := range tests {
|
||||||
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
|
got, err := NormalizeMachineArch(tt.args.arch)
|
||||||
|
if (err != nil) != tt.wantErr {
|
||||||
|
t.Errorf("NormalizeMachineArch() error = %v, wantErr %v", err, tt.wantErr)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if got != tt.want {
|
||||||
|
t.Errorf("NormalizeMachineArch() got = %v, want %v", got, tt.want)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
@ -1,8 +1,6 @@
|
|||||||
package vmconfigs
|
package vmconfigs
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
|
||||||
"net/url"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
gvproxy "github.com/containers/gvisor-tap-vsock/pkg/types"
|
gvproxy "github.com/containers/gvisor-tap-vsock/pkg/types"
|
||||||
@ -54,23 +52,6 @@ type MachineConfig struct {
|
|||||||
Starting bool
|
Starting bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// MachineImage describes a podman machine image
|
|
||||||
type MachineImage struct {
|
|
||||||
OCI *OCIMachineImage
|
|
||||||
FCOS *fcosMachineImage
|
|
||||||
}
|
|
||||||
|
|
||||||
// Pull downloads a machine image
|
|
||||||
func (m *MachineImage) Pull() error {
|
|
||||||
if m.OCI != nil {
|
|
||||||
return m.OCI.download()
|
|
||||||
}
|
|
||||||
if m.FCOS != nil {
|
|
||||||
return m.FCOS.download()
|
|
||||||
}
|
|
||||||
return errors.New("no valid machine image provider detected")
|
|
||||||
}
|
|
||||||
|
|
||||||
type machineImage interface { //nolint:unused
|
type machineImage interface { //nolint:unused
|
||||||
download() error
|
download() error
|
||||||
path() string
|
path() string
|
||||||
@ -93,20 +74,6 @@ func (o OCIMachineImage) download() error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
type fcosMachineImage struct {
|
|
||||||
// TODO JSON serial/deserial will write string to disk
|
|
||||||
// but in code is url.URL
|
|
||||||
Location url.URL // file://path/.qcow2 https://path/qcow2
|
|
||||||
}
|
|
||||||
|
|
||||||
func (f fcosMachineImage) download() error {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (f fcosMachineImage) path() string {
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
type VMProvider interface { //nolint:interfacebloat
|
type VMProvider interface { //nolint:interfacebloat
|
||||||
CreateVM(opts define.CreateVMOpts, mc *MachineConfig, builder *ignition.IgnitionBuilder) error
|
CreateVM(opts define.CreateVMOpts, mc *MachineConfig, builder *ignition.IgnitionBuilder) error
|
||||||
// GetDisk should be only temporary. It is largely here only because WSL disk pulling is different
|
// GetDisk should be only temporary. It is largely here only because WSL disk pulling is different
|
||||||
|
@ -8,14 +8,11 @@ import (
|
|||||||
"net/url"
|
"net/url"
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
"path/filepath"
|
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/sirupsen/logrus"
|
|
||||||
|
|
||||||
"github.com/containers/podman/v5/pkg/machine"
|
"github.com/containers/podman/v5/pkg/machine"
|
||||||
"github.com/containers/podman/v5/pkg/machine/define"
|
"github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -27,42 +24,6 @@ type FedoraDownload struct {
|
|||||||
machine.Download
|
machine.Download
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewFedoraDownloader
|
|
||||||
// deprecated
|
|
||||||
func NewFedoraDownloader(vmType define.VMType, vmName, releaseStream string) (machine.DistributionDownload, error) {
|
|
||||||
downloadURL, version, arch, size, err := GetFedoraDownloadForWSL()
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
cacheDir, err := machine.GetCacheDir(vmType)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
imageName := fmt.Sprintf("fedora-podman-%s-%s.tar.xz", arch, version)
|
|
||||||
|
|
||||||
f := FedoraDownload{
|
|
||||||
Download: machine.Download{
|
|
||||||
Arch: machine.GetFcosArch(),
|
|
||||||
Artifact: define.None,
|
|
||||||
CacheDir: cacheDir,
|
|
||||||
Format: define.Tar,
|
|
||||||
ImageName: imageName,
|
|
||||||
LocalPath: filepath.Join(cacheDir, imageName),
|
|
||||||
URL: downloadURL,
|
|
||||||
VMName: vmName,
|
|
||||||
Size: size,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
dataDir, err := machine.GetDataDir(vmType)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
f.Download.LocalUncompressedFile = f.GetLocalUncompressedFile(dataDir)
|
|
||||||
return f, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (f FedoraDownload) Get() *machine.Download {
|
func (f FedoraDownload) Get() *machine.Download {
|
||||||
return &f.Download
|
return &f.Download
|
||||||
}
|
}
|
||||||
|
152
vendor/github.com/coreos/stream-metadata-go/release/release.go
generated
vendored
152
vendor/github.com/coreos/stream-metadata-go/release/release.go
generated
vendored
@ -1,152 +0,0 @@
|
|||||||
// Package release contains APIs for interacting with a
|
|
||||||
// particular "release". Avoid this unless you are sure
|
|
||||||
// you need it. It's expected that CoreOS users interact
|
|
||||||
// with streams instead.
|
|
||||||
package release
|
|
||||||
|
|
||||||
import (
|
|
||||||
relrhcos "github.com/coreos/stream-metadata-go/release/rhcos"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Index models the release index:
|
|
||||||
// https://github.com/coreos/fedora-coreos-tracker/tree/main/metadata/release-index
|
|
||||||
type Index struct {
|
|
||||||
Note string `json:"note"` // used to note to users not to consume the release metadata index
|
|
||||||
Releases []IndexRelease `json:"releases"`
|
|
||||||
Metadata Metadata `json:"metadata"`
|
|
||||||
Stream string `json:"stream"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// IndexRelease is a "release pointer" from a release index
|
|
||||||
type IndexRelease struct {
|
|
||||||
Commits []IndexReleaseCommit `json:"commits"`
|
|
||||||
Version string `json:"version"`
|
|
||||||
MetadataURL string `json:"metadata"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// IndexReleaseCommit describes an ostree commit plus architecture
|
|
||||||
type IndexReleaseCommit struct {
|
|
||||||
Architecture string `json:"architecture"`
|
|
||||||
Checksum string `json:"checksum"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// Release contains details from release.json
|
|
||||||
type Release struct {
|
|
||||||
Release string `json:"release"`
|
|
||||||
Stream string `json:"stream"`
|
|
||||||
Metadata Metadata `json:"metadata"`
|
|
||||||
Architectures map[string]Arch `json:"architectures"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// Metadata is common metadata that contains last-modified
|
|
||||||
type Metadata struct {
|
|
||||||
LastModified string `json:"last-modified"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// Arch release details
|
|
||||||
type Arch struct {
|
|
||||||
Commit string `json:"commit"`
|
|
||||||
Media Media `json:"media"`
|
|
||||||
RHELCoreOSExtensions *relrhcos.Extensions `json:"rhel-coreos-extensions,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// Media contains release details for various platforms
|
|
||||||
type Media struct {
|
|
||||||
Aliyun *PlatformAliyun `json:"aliyun"`
|
|
||||||
AppleHV *PlatformBase `json:"applehv"`
|
|
||||||
Aws *PlatformAws `json:"aws"`
|
|
||||||
Azure *PlatformBase `json:"azure"`
|
|
||||||
AzureStack *PlatformBase `json:"azurestack"`
|
|
||||||
Digitalocean *PlatformBase `json:"digitalocean"`
|
|
||||||
Exoscale *PlatformBase `json:"exoscale"`
|
|
||||||
Gcp *PlatformGcp `json:"gcp"`
|
|
||||||
HyperV *PlatformBase `json:"hyperv"`
|
|
||||||
Ibmcloud *PlatformIBMCloud `json:"ibmcloud"`
|
|
||||||
KubeVirt *PlatformKubeVirt `json:"kubevirt"`
|
|
||||||
Metal *PlatformBase `json:"metal"`
|
|
||||||
Nutanix *PlatformBase `json:"nutanix"`
|
|
||||||
Openstack *PlatformBase `json:"openstack"`
|
|
||||||
PowerVS *PlatformIBMCloud `json:"powervs"`
|
|
||||||
Qemu *PlatformBase `json:"qemu"`
|
|
||||||
QemuSecex *PlatformBase `json:"qemu-secex"`
|
|
||||||
VirtualBox *PlatformBase `json:"virtualbox"`
|
|
||||||
Vmware *PlatformBase `json:"vmware"`
|
|
||||||
Vultr *PlatformBase `json:"vultr"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// PlatformBase with no cloud images
|
|
||||||
type PlatformBase struct {
|
|
||||||
Artifacts map[string]ImageFormat `json:"artifacts"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// PlatformAliyun contains Aliyun image information
|
|
||||||
type PlatformAliyun struct {
|
|
||||||
PlatformBase
|
|
||||||
Images map[string]CloudImage `json:"images"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// PlatformAws contains AWS image information
|
|
||||||
type PlatformAws struct {
|
|
||||||
PlatformBase
|
|
||||||
Images map[string]CloudImage `json:"images"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// PlatformGcp GCP image detail
|
|
||||||
type PlatformGcp struct {
|
|
||||||
PlatformBase
|
|
||||||
Image *GcpImage `json:"image"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// PlatformIBMCloud IBMCloud/PowerVS image detail
|
|
||||||
type PlatformIBMCloud struct {
|
|
||||||
PlatformBase
|
|
||||||
Images map[string]IBMCloudImage `json:"images"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// PlatformKubeVirt containerDisk metadata
|
|
||||||
type PlatformKubeVirt struct {
|
|
||||||
PlatformBase
|
|
||||||
Image *ContainerImage `json:"image"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// ImageFormat contains all artifacts for a single OS image
|
|
||||||
type ImageFormat struct {
|
|
||||||
Disk *Artifact `json:"disk,omitempty"`
|
|
||||||
Kernel *Artifact `json:"kernel,omitempty"`
|
|
||||||
Initramfs *Artifact `json:"initramfs,omitempty"`
|
|
||||||
Rootfs *Artifact `json:"rootfs,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// Artifact represents one image file, plus its metadata
|
|
||||||
type Artifact struct {
|
|
||||||
Location string `json:"location"`
|
|
||||||
Signature string `json:"signature"`
|
|
||||||
Sha256 string `json:"sha256"`
|
|
||||||
UncompressedSha256 string `json:"uncompressed-sha256,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// CloudImage generic image detail
|
|
||||||
type CloudImage struct {
|
|
||||||
Image string `json:"image"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// ContainerImage represents a tagged container image
|
|
||||||
type ContainerImage struct {
|
|
||||||
// Preferred way to reference the image, which might be by tag or digest
|
|
||||||
Image string `json:"image"`
|
|
||||||
DigestRef string `json:"digest-ref"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// GcpImage represents a GCP cloud image
|
|
||||||
type GcpImage struct {
|
|
||||||
Project string `json:"project"`
|
|
||||||
Family string `json:"family,omitempty"`
|
|
||||||
Name string `json:"name"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// IBMCloudImage represents an IBMCloud/PowerVS cloud object - which is an ova image for PowerVS and a qcow for IBMCloud in the cloud object storage bucket
|
|
||||||
type IBMCloudImage struct {
|
|
||||||
Object string `json:"object"`
|
|
||||||
Bucket string `json:"bucket"`
|
|
||||||
Url string `json:"url"`
|
|
||||||
}
|
|
14
vendor/github.com/coreos/stream-metadata-go/release/rhcos/rhcos.go
generated
vendored
14
vendor/github.com/coreos/stream-metadata-go/release/rhcos/rhcos.go
generated
vendored
@ -1,14 +0,0 @@
|
|||||||
package rhcos
|
|
||||||
|
|
||||||
// Extensions is data specific to Red Hat Enterprise Linux CoreOS
|
|
||||||
type Extensions struct {
|
|
||||||
AzureDisk *AzureDisk `json:"azure-disk,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// AzureDisk represents an Azure cloud image.
|
|
||||||
type AzureDisk struct {
|
|
||||||
// URL to an image already stored in Azure infrastructure
|
|
||||||
// that can be copied into an image gallery. Avoid creating VMs directly
|
|
||||||
// from this URL as that may lead to performance limitations.
|
|
||||||
URL string `json:"url,omitempty"`
|
|
||||||
}
|
|
296
vendor/github.com/coreos/stream-metadata-go/release/translate.go
generated
vendored
296
vendor/github.com/coreos/stream-metadata-go/release/translate.go
generated
vendored
@ -1,296 +0,0 @@
|
|||||||
package release
|
|
||||||
|
|
||||||
import (
|
|
||||||
"github.com/coreos/stream-metadata-go/stream"
|
|
||||||
"github.com/coreos/stream-metadata-go/stream/rhcos"
|
|
||||||
)
|
|
||||||
|
|
||||||
func mapArtifact(ra *Artifact) *stream.Artifact {
|
|
||||||
if ra == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
return &stream.Artifact{
|
|
||||||
Location: ra.Location,
|
|
||||||
Signature: ra.Signature,
|
|
||||||
Sha256: ra.Sha256,
|
|
||||||
UncompressedSha256: ra.UncompressedSha256,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func mapFormats(m map[string]ImageFormat) map[string]stream.ImageFormat {
|
|
||||||
r := make(map[string]stream.ImageFormat)
|
|
||||||
for k, v := range m {
|
|
||||||
r[k] = stream.ImageFormat{
|
|
||||||
Disk: mapArtifact(v.Disk),
|
|
||||||
Kernel: mapArtifact(v.Kernel),
|
|
||||||
Initramfs: mapArtifact(v.Initramfs),
|
|
||||||
Rootfs: mapArtifact(v.Rootfs),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return r
|
|
||||||
}
|
|
||||||
|
|
||||||
// Convert a release architecture to a stream architecture
|
|
||||||
func (releaseArch *Arch) toStreamArch(rel *Release) stream.Arch {
|
|
||||||
artifacts := make(map[string]stream.PlatformArtifacts)
|
|
||||||
cloudImages := stream.Images{}
|
|
||||||
var rhcosExt *rhcos.Extensions
|
|
||||||
relRHCOSExt := releaseArch.RHELCoreOSExtensions
|
|
||||||
if relRHCOSExt != nil {
|
|
||||||
rhcosExt = &rhcos.Extensions{}
|
|
||||||
}
|
|
||||||
|
|
||||||
if releaseArch.Media.Aliyun != nil {
|
|
||||||
artifacts["aliyun"] = stream.PlatformArtifacts{
|
|
||||||
Release: rel.Release,
|
|
||||||
Formats: mapFormats(releaseArch.Media.Aliyun.Artifacts),
|
|
||||||
}
|
|
||||||
aliyunImages := stream.ReplicatedImage{
|
|
||||||
Regions: make(map[string]stream.SingleImage),
|
|
||||||
}
|
|
||||||
if releaseArch.Media.Aliyun.Images != nil {
|
|
||||||
for region, image := range releaseArch.Media.Aliyun.Images {
|
|
||||||
si := stream.SingleImage{Release: rel.Release, Image: image.Image}
|
|
||||||
aliyunImages.Regions[region] = si
|
|
||||||
|
|
||||||
}
|
|
||||||
cloudImages.Aliyun = &aliyunImages
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if releaseArch.Media.AppleHV != nil {
|
|
||||||
artifacts["applehv"] = stream.PlatformArtifacts{
|
|
||||||
Release: rel.Release,
|
|
||||||
Formats: mapFormats(releaseArch.Media.AppleHV.Artifacts),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if releaseArch.Media.Aws != nil {
|
|
||||||
artifacts["aws"] = stream.PlatformArtifacts{
|
|
||||||
Release: rel.Release,
|
|
||||||
Formats: mapFormats(releaseArch.Media.Aws.Artifacts),
|
|
||||||
}
|
|
||||||
awsAmis := stream.ReplicatedImage{
|
|
||||||
Regions: make(map[string]stream.SingleImage),
|
|
||||||
}
|
|
||||||
if releaseArch.Media.Aws.Images != nil {
|
|
||||||
for region, ami := range releaseArch.Media.Aws.Images {
|
|
||||||
si := stream.SingleImage{Release: rel.Release, Image: ami.Image}
|
|
||||||
awsAmis.Regions[region] = si
|
|
||||||
|
|
||||||
}
|
|
||||||
cloudImages.Aws = &awsAmis
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if releaseArch.Media.Azure != nil {
|
|
||||||
artifacts["azure"] = stream.PlatformArtifacts{
|
|
||||||
Release: rel.Release,
|
|
||||||
Formats: mapFormats(releaseArch.Media.Azure.Artifacts),
|
|
||||||
}
|
|
||||||
|
|
||||||
if relRHCOSExt != nil {
|
|
||||||
az := relRHCOSExt.AzureDisk
|
|
||||||
if az != nil {
|
|
||||||
rhcosExt.AzureDisk = &rhcos.AzureDisk{
|
|
||||||
Release: rel.Release,
|
|
||||||
URL: az.URL,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// In the future this is where we'd also add FCOS Marketplace data.
|
|
||||||
// See https://github.com/coreos/stream-metadata-go/issues/13
|
|
||||||
}
|
|
||||||
|
|
||||||
if releaseArch.Media.AzureStack != nil {
|
|
||||||
artifacts["azurestack"] = stream.PlatformArtifacts{
|
|
||||||
Release: rel.Release,
|
|
||||||
Formats: mapFormats(releaseArch.Media.AzureStack.Artifacts),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if releaseArch.Media.Digitalocean != nil {
|
|
||||||
artifacts["digitalocean"] = stream.PlatformArtifacts{
|
|
||||||
Release: rel.Release,
|
|
||||||
Formats: mapFormats(releaseArch.Media.Digitalocean.Artifacts),
|
|
||||||
}
|
|
||||||
|
|
||||||
/* We're producing artifacts but they're not yet available
|
|
||||||
in DigitalOcean as distribution images.
|
|
||||||
digitalOceanImage := stream.CloudImage{Image: fmt.Sprintf("fedora-coreos-%s", Stream)}
|
|
||||||
cloudImages.Digitalocean = &digitalOceanImage
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
if releaseArch.Media.Exoscale != nil {
|
|
||||||
artifacts["exoscale"] = stream.PlatformArtifacts{
|
|
||||||
Release: rel.Release,
|
|
||||||
Formats: mapFormats(releaseArch.Media.Exoscale.Artifacts),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if releaseArch.Media.Gcp != nil {
|
|
||||||
artifacts["gcp"] = stream.PlatformArtifacts{
|
|
||||||
Release: rel.Release,
|
|
||||||
Formats: mapFormats(releaseArch.Media.Gcp.Artifacts),
|
|
||||||
}
|
|
||||||
|
|
||||||
if releaseArch.Media.Gcp.Image != nil {
|
|
||||||
cloudImages.Gcp = &stream.GcpImage{
|
|
||||||
Release: rel.Release,
|
|
||||||
Name: releaseArch.Media.Gcp.Image.Name,
|
|
||||||
Family: releaseArch.Media.Gcp.Image.Family,
|
|
||||||
Project: releaseArch.Media.Gcp.Image.Project,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if releaseArch.Media.HyperV != nil {
|
|
||||||
artifacts["hyperv"] = stream.PlatformArtifacts{
|
|
||||||
Release: rel.Release,
|
|
||||||
Formats: mapFormats(releaseArch.Media.HyperV.Artifacts),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if releaseArch.Media.Ibmcloud != nil {
|
|
||||||
artifacts["ibmcloud"] = stream.PlatformArtifacts{
|
|
||||||
Release: rel.Release,
|
|
||||||
Formats: mapFormats(releaseArch.Media.Ibmcloud.Artifacts),
|
|
||||||
}
|
|
||||||
ibmcloudObjects := stream.ReplicatedObject{
|
|
||||||
Regions: make(map[string]stream.SingleObject),
|
|
||||||
}
|
|
||||||
if releaseArch.Media.Ibmcloud.Images != nil {
|
|
||||||
for region, object := range releaseArch.Media.Ibmcloud.Images {
|
|
||||||
so := stream.SingleObject{
|
|
||||||
Release: rel.Release,
|
|
||||||
Object: object.Object,
|
|
||||||
Bucket: object.Bucket,
|
|
||||||
Url: object.Url,
|
|
||||||
}
|
|
||||||
ibmcloudObjects.Regions[region] = so
|
|
||||||
|
|
||||||
}
|
|
||||||
cloudImages.Ibmcloud = &ibmcloudObjects
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if releaseArch.Media.KubeVirt != nil {
|
|
||||||
artifacts["kubevirt"] = stream.PlatformArtifacts{
|
|
||||||
Release: rel.Release,
|
|
||||||
Formats: mapFormats(releaseArch.Media.KubeVirt.Artifacts),
|
|
||||||
}
|
|
||||||
if releaseArch.Media.KubeVirt.Image != nil {
|
|
||||||
cloudImages.KubeVirt = &stream.ContainerImage{
|
|
||||||
Release: rel.Release,
|
|
||||||
Image: releaseArch.Media.KubeVirt.Image.Image,
|
|
||||||
DigestRef: releaseArch.Media.KubeVirt.Image.DigestRef,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if releaseArch.Media.Metal != nil {
|
|
||||||
artifacts["metal"] = stream.PlatformArtifacts{
|
|
||||||
Release: rel.Release,
|
|
||||||
Formats: mapFormats(releaseArch.Media.Metal.Artifacts),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if releaseArch.Media.Nutanix != nil {
|
|
||||||
artifacts["nutanix"] = stream.PlatformArtifacts{
|
|
||||||
Release: rel.Release,
|
|
||||||
Formats: mapFormats(releaseArch.Media.Nutanix.Artifacts),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if releaseArch.Media.Openstack != nil {
|
|
||||||
artifacts["openstack"] = stream.PlatformArtifacts{
|
|
||||||
Release: rel.Release,
|
|
||||||
Formats: mapFormats(releaseArch.Media.Openstack.Artifacts),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// if releaseArch.Media.Packet != nil {
|
|
||||||
// packet := StreamMediaDetails{
|
|
||||||
// Release: rel.Release,
|
|
||||||
// Formats: releaseArch.Media.Packet.Artifacts,
|
|
||||||
// }
|
|
||||||
// artifacts.Packet = &packet
|
|
||||||
|
|
||||||
// packetImage := StreamCloudImage{Image: fmt.Sprintf("fedora_coreos_%s", rel.Stream)}
|
|
||||||
// cloudImages.Packet = &packetImage
|
|
||||||
// }
|
|
||||||
|
|
||||||
if releaseArch.Media.PowerVS != nil {
|
|
||||||
artifacts["powervs"] = stream.PlatformArtifacts{
|
|
||||||
Release: rel.Release,
|
|
||||||
Formats: mapFormats(releaseArch.Media.PowerVS.Artifacts),
|
|
||||||
}
|
|
||||||
powervsObjects := stream.ReplicatedObject{
|
|
||||||
Regions: make(map[string]stream.SingleObject),
|
|
||||||
}
|
|
||||||
if releaseArch.Media.PowerVS.Images != nil {
|
|
||||||
for region, object := range releaseArch.Media.PowerVS.Images {
|
|
||||||
so := stream.SingleObject{
|
|
||||||
Release: rel.Release,
|
|
||||||
Object: object.Object,
|
|
||||||
Bucket: object.Bucket,
|
|
||||||
Url: object.Url,
|
|
||||||
}
|
|
||||||
powervsObjects.Regions[region] = so
|
|
||||||
|
|
||||||
}
|
|
||||||
cloudImages.PowerVS = &powervsObjects
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if releaseArch.Media.Qemu != nil {
|
|
||||||
artifacts["qemu"] = stream.PlatformArtifacts{
|
|
||||||
Release: rel.Release,
|
|
||||||
Formats: mapFormats(releaseArch.Media.Qemu.Artifacts),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if releaseArch.Media.QemuSecex != nil {
|
|
||||||
artifacts["qemu-secex"] = stream.PlatformArtifacts{
|
|
||||||
Release: rel.Release,
|
|
||||||
Formats: mapFormats(releaseArch.Media.QemuSecex.Artifacts),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if releaseArch.Media.VirtualBox != nil {
|
|
||||||
artifacts["virtualbox"] = stream.PlatformArtifacts{
|
|
||||||
Release: rel.Release,
|
|
||||||
Formats: mapFormats(releaseArch.Media.VirtualBox.Artifacts),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if releaseArch.Media.Vmware != nil {
|
|
||||||
artifacts["vmware"] = stream.PlatformArtifacts{
|
|
||||||
Release: rel.Release,
|
|
||||||
Formats: mapFormats(releaseArch.Media.Vmware.Artifacts),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if releaseArch.Media.Vultr != nil {
|
|
||||||
artifacts["vultr"] = stream.PlatformArtifacts{
|
|
||||||
Release: rel.Release,
|
|
||||||
Formats: mapFormats(releaseArch.Media.Vultr.Artifacts),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return stream.Arch{
|
|
||||||
Artifacts: artifacts,
|
|
||||||
Images: cloudImages,
|
|
||||||
RHELCoreOSExtensions: rhcosExt,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ToStreamArchitectures converts a release to a stream
|
|
||||||
func (rel *Release) ToStreamArchitectures() map[string]stream.Arch {
|
|
||||||
streamArch := make(map[string]stream.Arch)
|
|
||||||
for arch, releaseArch := range rel.Architectures {
|
|
||||||
streamArch[arch] = releaseArch.toStreamArch(rel)
|
|
||||||
}
|
|
||||||
return streamArch
|
|
||||||
}
|
|
2
vendor/modules.txt
vendored
2
vendor/modules.txt
vendored
@ -423,8 +423,6 @@ github.com/coreos/go-systemd/v22/sdjournal
|
|||||||
## explicit; go 1.18
|
## explicit; go 1.18
|
||||||
github.com/coreos/stream-metadata-go/fedoracoreos
|
github.com/coreos/stream-metadata-go/fedoracoreos
|
||||||
github.com/coreos/stream-metadata-go/fedoracoreos/internals
|
github.com/coreos/stream-metadata-go/fedoracoreos/internals
|
||||||
github.com/coreos/stream-metadata-go/release
|
|
||||||
github.com/coreos/stream-metadata-go/release/rhcos
|
|
||||||
github.com/coreos/stream-metadata-go/stream
|
github.com/coreos/stream-metadata-go/stream
|
||||||
github.com/coreos/stream-metadata-go/stream/rhcos
|
github.com/coreos/stream-metadata-go/stream/rhcos
|
||||||
# github.com/crc-org/crc/v2 v2.32.0
|
# github.com/crc-org/crc/v2 v2.32.0
|
||||||
|
Reference in New Issue
Block a user