Skip to content

Commit f82d642

Browse files
committed
add openSUSE Leap 16 handling
Signed-off-by: Dirk Müller <[email protected]>
1 parent e67833f commit f82d642

File tree

5 files changed

+57
-3
lines changed

5 files changed

+57
-3
lines changed

artifacts/opensuse/leap/leap.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,19 @@ type leap struct {
2424
var _ api.Artifact = &leap{}
2525

2626
const (
27-
baseURLFmt = "https://download.opensuse.org/distribution/leap/%s/appliances/openSUSE-Leap-%s-Minimal-VM.%s-Cloud.qcow2"
28-
description = `OpenSUSE Leap images for KubeVirt.
27+
Leap16baseURLFmt = "https://download.opensuse.org/distribution/leap/%s/appliances/Leap-%s-Minimal-VM.%s-Cloud.qcow2"
28+
Leap15baseURLFmt = "https://download.opensuse.org/distribution/leap/%s/appliances/openSUSE-Leap-%s-Minimal-VM.%s-Cloud.qcow2"
29+
description = `OpenSUSE Leap images for KubeVirt.
2930
<br />
3031
<br />
3132
Visit [get.opensuse.org/leap/](https://get.opensuse.org/leap/) to learn more about OpenSUSE Leap.`
3233
)
3334

3435
func (l *leap) Inspect() (*api.ArtifactDetails, error) {
35-
baseURL := fmt.Sprintf(baseURLFmt, l.Version, l.Version, l.Arch)
36+
baseURL := fmt.Sprintf(Leap16baseURLFmt, l.Version, l.Version, l.Arch)
37+
if strings.HasPrefix(l.Version, "15") {
38+
baseURL = fmt.Sprintf(Leap15baseURLFmt, l.Version, l.Version, l.Arch)
39+
}
3640
checksumBytes, err := l.getter.GetAll(baseURL + ".sha256")
3741
if err != nil {
3842
return nil, err

artifacts/opensuse/leap/leap_test.go

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,47 @@ var _ = Describe("OpenSUSE Leap", func() {
2828
Expect(c.Metadata()).To(Equal(metadata))
2929
Expect(err).NotTo(HaveOccurred())
3030
},
31+
Entry("leap:16.0 x86_64", "x86_64", "16.0", "testdata/Leap-16.0-Minimal-VM.x86_64-Cloud.qcow2.sha256",
32+
map[string]string{
33+
common.DefaultInstancetypeEnv: "u1.medium",
34+
common.DefaultPreferenceEnv: "opensuse.leap",
35+
},
36+
&api.ArtifactDetails{
37+
Checksum: "8a18cb174d783367e48d34e4e379c5e8f77b0868bcb09350e3627e40090f16fb",
38+
DownloadURL: "https://download.opensuse.org/distribution/leap/16.0/appliances/Leap-16.0-Minimal-VM.x86_64-Cloud.qcow2",
39+
ImageArchitecture: "amd64",
40+
},
41+
&api.Metadata{
42+
Name: "opensuse-leap",
43+
Version: "16.0",
44+
Description: description,
45+
ExampleUserData: docs.UserData{
46+
Username: "opensuse",
47+
},
48+
EnvVariables: map[string]string{
49+
common.DefaultInstancetypeEnv: "u1.medium",
50+
common.DefaultPreferenceEnv: "opensuse.leap",
51+
},
52+
Arch: "x86_64",
53+
},
54+
),
55+
Entry("leap:16.0 aarch64", "aarch64", "16.0", "testdata/Leap-16.0-Minimal-VM.aarch64-Cloud.qcow2.sha256",
56+
nil,
57+
&api.ArtifactDetails{
58+
Checksum: "3fb04efe905b065c25ef1953ce0b53ec680ec661d919c413e2d25986296a0750",
59+
DownloadURL: "https://download.opensuse.org/distribution/leap/16.0/appliances/Leap-16.0-Minimal-VM.aarch64-Cloud.qcow2",
60+
ImageArchitecture: "arm64",
61+
},
62+
&api.Metadata{
63+
Name: "opensuse-leap",
64+
Version: "16.0",
65+
Description: description,
66+
ExampleUserData: docs.UserData{
67+
Username: "opensuse",
68+
},
69+
Arch: "aarch64",
70+
},
71+
),
3172
Entry("leap:15.6 x86_64", "x86_64", "15.6", "testdata/openSUSE-Leap-15.6-Minimal-VM.x86_64-Cloud.qcow2.sha256",
3273
map[string]string{
3374
common.DefaultInstancetypeEnv: "u1.medium",
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3fb04efe905b065c25ef1953ce0b53ec680ec661d919c413e2d25986296a0750 Leap-16.0-Minimal-VM.aarch64-Cloud.qcow2
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
8a18cb174d783367e48d34e4e379c5e8f77b0868bcb09350e3627e40090f16fb Leap-16.0-Minimal-VM.x86_64-Cloud.qcow2

cmd/medius/common/registry.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,13 @@ var staticRegistry = []Entry{
8080
},
8181
UseForDocs: true,
8282
},
83+
{
84+
Artifacts: []api.Artifact{
85+
leap.New("x86_64", "16.0", defaultEnvVariables("u1.medium", "opensuse.leap")),
86+
leap.New("aarch64", "16.0", defaultEnvVariables("u1.medium", "opensuse.leap")),
87+
},
88+
UseForDocs: true,
89+
},
8390
{
8491
Artifacts: []api.Artifact{
8592
leap.New("x86_64", "15.6", defaultEnvVariables("u1.medium", "opensuse.leap")),

0 commit comments

Comments
 (0)