aboutsummaryrefslogtreecommitdiff
path: root/pkg/machine/fcos_arm64.go
blob: ab50ca874a5f592206c30b854559c2a6133a929a (plain)
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
package machine

import (
	"encoding/json"
	"fmt"
	"io/ioutil"
	"net/http"

	"github.com/sirupsen/logrus"
)

const aarchBaseURL = "https://fedorapeople.org/groups/fcos-images/builds/latest/aarch64/"

// Total hack until automation is possible.
// We need a proper json file at least to automate
func getFCOSDownload() (*fcosDownloadInfo, error) {

	meta := Build{}
	fmt.Println(aarchBaseURL + "meta.json")
	resp, err := http.Get(aarchBaseURL + "meta.json")
	if err != nil {
		return nil, err
	}
	body, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		return nil, err
	}
	defer func() {
		if err := resp.Body.Close(); err != nil {
			logrus.Error(err)
		}
	}()
	if err := json.Unmarshal(body, &meta); err != nil {
		return nil, err
	}
	return &fcosDownloadInfo{
		Location:  "https://fedorapeople.org/groups/fcos-images/builds/latest/aarch64/fedora-coreos-33.20210310.dev.0-qemu.aarch64.qcow2",
		Release:   "",
		Sha256Sum: meta.BuildArtifacts.Qemu.Sha256,
	}, nil
}

/*
	All of this can be nuked when fcos upstream generates a proper meta data file for aarch.
*/
type AliyunImage struct {
	ImageID string `json:"id"`
	Region  string `json:"name"`
}

type Amis struct {
	Hvm      string `json:"hvm"`
	Region   string `json:"name"`
	Snapshot string `json:"snapshot"`
}

type Artifact struct {
	Path               string  `json:"path"`
	Sha256             string  `json:"sha256"`
	SizeInBytes        float64 `json:"size,omitempty"`
	UncompressedSha256 string  `json:"uncompressed-sha256,omitempty"`
	UncompressedSize   int     `json:"uncompressed-size,omitempty"`
}

type Build struct {
	AlibabaAliyunUploads      []AliyunImage         `json:"aliyun,omitempty"`
	Amis                      []Amis                `json:"amis,omitempty"`
	Architecture              string                `json:"coreos-assembler.basearch,omitempty"`
	Azure                     *Cloudartifact        `json:"azure,omitempty"`
	BuildArtifacts            *BuildArtifacts       `json:"images,omitempty"`
	BuildID                   string                `json:"buildid"`
	BuildRef                  string                `json:"ref,omitempty"`
	BuildSummary              string                `json:"summary"`
	BuildTimeStamp            string                `json:"coreos-assembler.build-timestamp,omitempty"`
	BuildURL                  string                `json:"build-url,omitempty"`
	ConfigGitRev              string                `json:"coreos-assembler.config-gitrev,omitempty"`
	ContainerConfigGit        *Git                  `json:"coreos-assembler.container-config-git,omitempty"`
	CoreOsSource              string                `json:"coreos-assembler.code-source,omitempty"`
	CosaContainerImageGit     *Git                  `json:"coreos-assembler.container-image-git,omitempty"`
	CosaDelayedMetaMerge      bool                  `json:"coreos-assembler.delayed-meta-merge,omitempty"`
	CosaImageChecksum         string                `json:"coreos-assembler.image-config-checksum,omitempty"`
	CosaImageVersion          int                   `json:"coreos-assembler.image-genver,omitempty"`
	Extensions                *Extensions           `json:"extensions,omitempty"`
	FedoraCoreOsParentCommit  string                `json:"fedora-coreos.parent-commit,omitempty"`
	FedoraCoreOsParentVersion string                `json:"fedora-coreos.parent-version,omitempty"`
	Gcp                       *Gcp                  `json:"gcp,omitempty"`
	GitDirty                  string                `json:"coreos-assembler.config-dirty,omitempty"`
	ImageInputChecksum        string                `json:"coreos-assembler.image-input-checksum,omitempty"`
	InputHasOfTheRpmOstree    string                `json:"rpm-ostree-inputhash"`
	MetaStamp                 float64               `json:"coreos-assembler.meta-stamp,omitempty"`
	Name                      string                `json:"name"`
	Oscontainer               *Image                `json:"oscontainer,omitempty"`
	OstreeCommit              string                `json:"ostree-commit"`
	OstreeContentBytesWritten int                   `json:"ostree-content-bytes-written,omitempty"`
	OstreeContentChecksum     string                `json:"ostree-content-checksum"`
	OstreeNCacheHits          int                   `json:"ostree-n-cache-hits,omitempty"`
	OstreeNContentTotal       int                   `json:"ostree-n-content-total,omitempty"`
	OstreeNContentWritten     int                   `json:"ostree-n-content-written,omitempty"`
	OstreeNMetadataTotal      int                   `json:"ostree-n-metadata-total,omitempty"`
	OstreeNMetadataWritten    int                   `json:"ostree-n-metadata-written,omitempty"`
	OstreeTimestamp           string                `json:"ostree-timestamp"`
	OstreeVersion             string                `json:"ostree-version"`
	OverridesActive           bool                  `json:"coreos-assembler.overrides-active,omitempty"`
	PkgdiffAgainstParent      PackageSetDifferences `json:"parent-pkgdiff,omitempty"`
	PkgdiffBetweenBuilds      PackageSetDifferences `json:"pkgdiff,omitempty"`
	ReleasePayload            *Image                `json:"release-payload,omitempty"`
}

type BuildArtifacts struct {
	Aliyun        *Artifact `json:"aliyun,omitempty"`
	Aws           *Artifact `json:"aws,omitempty"`
	Azure         *Artifact `json:"azure,omitempty"`
	AzureStack    *Artifact `json:"azurestack,omitempty"`
	Dasd          *Artifact `json:"dasd,omitempty"`
	DigitalOcean  *Artifact `json:"digitalocean,omitempty"`
	Exoscale      *Artifact `json:"exoscale,omitempty"`
	Gcp           *Artifact `json:"gcp,omitempty"`
	IbmCloud      *Artifact `json:"ibmcloud,omitempty"`
	Initramfs     *Artifact `json:"initramfs,omitempty"`
	Iso           *Artifact `json:"iso,omitempty"`
	Kernel        *Artifact `json:"kernel,omitempty"`
	LiveInitramfs *Artifact `json:"live-initramfs,omitempty"`
	LiveIso       *Artifact `json:"live-iso,omitempty"`
	LiveKernel    *Artifact `json:"live-kernel,omitempty"`
	LiveRootfs    *Artifact `json:"live-rootfs,omitempty"`
	Metal         *Artifact `json:"metal,omitempty"`
	Metal4KNative *Artifact `json:"metal4k,omitempty"`
	OpenStack     *Artifact `json:"openstack,omitempty"`
	Ostree        Artifact  `json:"ostree"`
	Qemu          *Artifact `json:"qemu,omitempty"`
	Vmware        *Artifact `json:"vmware,omitempty"`
	Vultr         *Artifact `json:"vultr,omitempty"`
}

type Cloudartifact struct {
	Image string `json:"image"`
	URL   string `json:"url"`
}

type Extensions struct {
	Manifest       map[string]interface{} `json:"manifest"`
	Path           string                 `json:"path"`
	RpmOstreeState string                 `json:"rpm-ostree-state"`
	Sha256         string                 `json:"sha256"`
}

type Gcp struct {
	ImageFamily  string `json:"family,omitempty"`
	ImageName    string `json:"image"`
	ImageProject string `json:"project,omitempty"`
	URL          string `json:"url"`
}

type Git struct {
	Branch string `json:"branch,omitempty"`
	Commit string `json:"commit"`
	Dirty  string `json:"dirty,omitempty"`
	Origin string `json:"origin"`
}

type Image struct {
	Comment string `json:"comment,omitempty"`
	Digest  string `json:"digest"`
	Image   string `json:"image"`
}

type Items interface{}

type PackageSetDifferences []Items