Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 27 additions & 13 deletions release/release.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,20 @@ type Arch struct {

// Media contains release details for various platforms
type Media struct {
Aliyun *PlatformAliyun `json:"aliyun"`
Aws *PlatformAws `json:"aws"`
Azure *PlatformBase `json:"azure"`
AzureStack *PlatformBase `json:"azurestack"`
Digitalocean *PlatformBase `json:"digitalocean"`
Exoscale *PlatformBase `json:"exoscale"`
Gcp *PlatformGcp `json:"gcp"`
Ibmcloud *PlatformBase `json:"ibmcloud"`
Metal *PlatformBase `json:"metal"`
Openstack *PlatformBase `json:"openstack"`
Qemu *PlatformBase `json:"qemu"`
Vmware *PlatformBase `json:"vmware"`
Vultr *PlatformBase `json:"vultr"`
Aliyun *PlatformAliyun `json:"aliyun"`
Aws *PlatformAws `json:"aws"`
Azure *PlatformBase `json:"azure"`
AzureStack *PlatformBase `json:"azurestack"`
Digitalocean *PlatformBase `json:"digitalocean"`
Exoscale *PlatformBase `json:"exoscale"`
Gcp *PlatformGcp `json:"gcp"`
Ibmcloud *PlatformIBMCloud `json:"ibmcloud"`
Metal *PlatformBase `json:"metal"`
Openstack *PlatformBase `json:"openstack"`
PowerVS *PlatformIBMCloud `json:"powervs"`
Qemu *PlatformBase `json:"qemu"`
Vmware *PlatformBase `json:"vmware"`
Vultr *PlatformBase `json:"vultr"`
}

// PlatformBase with no cloud images
Expand All @@ -90,6 +91,12 @@ type PlatformGcp struct {
Image *GcpImage `json:"image"`
}

// PlatformIBMCloud IBMCloud/PowerVS image detail
type PlatformIBMCloud struct {
PlatformBase
Images map[string]IBMCloudImage `json:"images"`
}

// ImageFormat contains all artifacts for a single OS image
type ImageFormat struct {
Disk *Artifact `json:"disk,omitempty"`
Expand Down Expand Up @@ -117,3 +124,10 @@ type GcpImage struct {
Family string `json:"family,omitempty"`
Name string `json:"name,omitempty"`
}

// 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"`
}
39 changes: 39 additions & 0 deletions release/translate.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,22 @@ func (releaseArch *Arch) toStreamArch(rel *Release) stream.Arch {
Release: rel.Release,
Formats: mapFormats(releaseArch.Media.Ibmcloud.Artifacts),
}
ibmcloudObjects := stream.ReplicatedObject{
Regions: make(map[string]stream.RegionObject),
}
if releaseArch.Media.Ibmcloud.Images != nil {
for region, object := range releaseArch.Media.Ibmcloud.Images {
ri := stream.RegionObject{
Release: rel.Release,
Object: object.Object,
Bucket: object.Bucket,
Url: object.Url,
}
ibmcloudObjects.Regions[region] = ri

}
cloudImages.Ibmcloud = &ibmcloudObjects
}
}

// if releaseArch.Media.Packet != nil {
Expand All @@ -169,6 +185,29 @@ func (releaseArch *Arch) toStreamArch(rel *Release) stream.Arch {
}
}

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.RegionObject),
}
if releaseArch.Media.PowerVS.Images != nil {
for region, object := range releaseArch.Media.PowerVS.Images {
ri := stream.RegionObject{
Release: rel.Release,
Object: object.Object,
Bucket: object.Bucket,
Url: object.Url,
}
powervsObjects.Regions[region] = ri

}
cloudImages.PowerVS = &powervsObjects
}
}

if releaseArch.Media.Qemu != nil {
artifacts["qemu"] = stream.PlatformArtifacts{
Release: rel.Release,
Expand Down
21 changes: 18 additions & 3 deletions stream/stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,11 @@ type Artifact struct {

// Images contains images available in cloud providers
type Images struct {
Aliyun *ReplicatedImage `json:"aliyun,omitempty"`
Aws *AwsImage `json:"aws,omitempty"`
Gcp *GcpImage `json:"gcp,omitempty"`
Aliyun *ReplicatedImage `json:"aliyun,omitempty"`
Aws *AwsImage `json:"aws,omitempty"`
Gcp *GcpImage `json:"gcp,omitempty"`
Ibmcloud *ReplicatedObject `json:"ibmcloud,omitempty"`
PowerVS *ReplicatedObject `json:"powervs,omitempty"`
}

// ReplicatedImage represents an image in all regions of an AWS-like cloud
Expand All @@ -80,3 +82,16 @@ type GcpImage struct {
Family string `json:"family,omitempty"`
Name string `json:"name,omitempty"`
}

// ReplicatedObject represents an object in all regions of an IBMCloud-like cloud
type ReplicatedObject struct {
Regions map[string]RegionObject `json:"regions,omitempty"`
}

// RegionObject represents an IBMCloud/PowerVS cloud image
type RegionObject struct {
Release string `json:"release"`
Object string `json:"object"`
Bucket string `json:"bucket"`
Url string `json:"url"`
}
Comment thread
bgilbert marked this conversation as resolved.