-
Notifications
You must be signed in to change notification settings - Fork 25
/
artifact.go
76 lines (65 loc) · 2.51 KB
/
artifact.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
package api
import (
"context"
"fmt"
v1 "kubevirt.io/api/core/v1"
"kubevirt.io/containerdisks/pkg/docs"
)
type ArtifactTest func(ctx context.Context, vmi *v1.VirtualMachineInstance, params *ArtifactTestParams) error
type ArtifactTestParams struct {
// Username is the username used to log in into the VM.
Username string
// PrivateKey is the private key used to log in into the VM.
PrivateKey interface{}
}
type ArtifactResult struct {
// Tags contains all tags the built containerdisk was tagged with.
Tags []string `json:",omitempty"`
// Stage is the current stage of the containerdisk
Stage string
// Err indicates if an error happened while creating, verifying or promoting a containerdisk.
Err string `json:",omitempty"`
}
type ArtifactDetails struct {
// SHA256Sum is the checksum of the image to download.
SHA256Sum string
// DownloadURL points to the target image.
DownloadURL string
// ImageArchitecture is the target architecture of the image.
ImageArchitecture string
// Compression describes the compression format of the downloaded image.
// Supported are "" (none), "gzip" and "xz".
Compression string
// AdditionalUniqueTags describes additional tags which furter specify the downloaded
// artifact version. For instance the main moving tag for fedora 35 would be '35' and here additional tags
// like '35-1.2'. This is useful for people to easier cross-reference the sources.
AdditionalUniqueTags []string
}
type Metadata struct {
// Name of the resulting container image in the remote container registry. For example "fedora".
Name string
// Version is the moving tag on the container image. For example "35".
Version string
// Description of the project in Markdown format.
Description string
// CloudInit/Ignition Payload example.
ExampleUserData docs.UserData
// EnvVariables contains additional env variables which should be added to the resulting containerdisk.
// These env variables can e.g. describe an appropriate instancetype or preference.
EnvVariables map[string]string
}
func (m Metadata) Describe() string {
return fmt.Sprintf("%s:%s", m.Name, m.Version)
}
type Artifact interface {
Inspect() (*ArtifactDetails, error)
Metadata() *Metadata
VM(name, imgRef, userData string) *v1.VirtualMachine
UserData(data *docs.UserData) string
Tests() []ArtifactTest
}
type ArtifactsGatherer interface {
// Gather must return a sorted list of dynamically gathered artifacts.
// Artifacts have to be sorted in descending order with the latest release coming first.
Gather() ([][]Artifact, error)
}