Skip to content

Commit

Permalink
Merge pull request #66 from bgilbert/sort
Browse files Browse the repository at this point in the history
release: sort platform translation code in `toStreamArch()`
  • Loading branch information
bgilbert authored Jun 28, 2023
2 parents 7269cd1 + c8c6046 commit befd63a
Showing 1 changed file with 45 additions and 45 deletions.
90 changes: 45 additions & 45 deletions release/translate.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,17 +102,23 @@ func (releaseArch *Arch) toStreamArch(rel *Release) stream.Arch {
}
}

if releaseArch.Media.Exoscale != nil {
artifacts["exoscale"] = stream.PlatformArtifacts{
if releaseArch.Media.Digitalocean != nil {
artifacts["digitalocean"] = stream.PlatformArtifacts{
Release: rel.Release,
Formats: mapFormats(releaseArch.Media.Exoscale.Artifacts),
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.Vultr != nil {
artifacts["vultr"] = stream.PlatformArtifacts{
if releaseArch.Media.Exoscale != nil {
artifacts["exoscale"] = stream.PlatformArtifacts{
Release: rel.Release,
Formats: mapFormats(releaseArch.Media.Vultr.Artifacts),
Formats: mapFormats(releaseArch.Media.Exoscale.Artifacts),
}
}

Expand All @@ -132,33 +138,6 @@ func (releaseArch *Arch) toStreamArch(rel *Release) stream.Arch {
}
}

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.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.HyperV != nil {
artifacts["hyperv"] = stream.PlatformArtifacts{
Release: rel.Release,
Expand Down Expand Up @@ -189,16 +168,26 @@ func (releaseArch *Arch) toStreamArch(rel *Release) stream.Arch {
}
}

// if releaseArch.Media.Packet != nil {
// packet := StreamMediaDetails{
// Release: rel.Release,
// Formats: releaseArch.Media.Packet.Artifacts,
// }
// artifacts.Packet = &packet
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,
}
}
}

// packetImage := StreamCloudImage{Image: fmt.Sprintf("fedora_coreos_%s", rel.Stream)}
// cloudImages.Packet = &packetImage
// }
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{
Expand All @@ -214,6 +203,17 @@ func (releaseArch *Arch) toStreamArch(rel *Release) stream.Arch {
}
}

// 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,
Expand Down Expand Up @@ -265,10 +265,10 @@ func (releaseArch *Arch) toStreamArch(rel *Release) stream.Arch {
}
}

if releaseArch.Media.Metal != nil {
artifacts["metal"] = stream.PlatformArtifacts{
if releaseArch.Media.Vultr != nil {
artifacts["vultr"] = stream.PlatformArtifacts{
Release: rel.Release,
Formats: mapFormats(releaseArch.Media.Metal.Artifacts),
Formats: mapFormats(releaseArch.Media.Vultr.Artifacts),
}
}

Expand Down

0 comments on commit befd63a

Please sign in to comment.