Skip to content

Commit

Permalink
feat: arm containerdisks
Browse files Browse the repository at this point in the history
Add an option to build aarch64 containerdisks.

Jira-Url: https://issues.redhat.com/browse/CNV-37406
Signed-off-by: Ben Oukhanov <[email protected]>
  • Loading branch information
codingben committed Feb 20, 2024
1 parent adba148 commit 806f88e
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 13 deletions.
4 changes: 2 additions & 2 deletions artifacts/centos/centos.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,11 @@ func (c *centos) Tests() []api.ArtifactTest {
}

// New accepts CentOS 7 and 8 versions. Example patterns are 7-2111, 7-2009, 8.3, 8.4, ...
func New(release string, additionalLabels map[string]string) *centos {
func New(release, arch string, additionalLabels map[string]string) *centos {
return &centos{
Version: release,
Variant: "GenericCloud",
Arch: "x86_64",
Arch: arch,
getter: &http.HTTPGetter{},
AdditionalLabels: additionalLabels,
}
Expand Down
4 changes: 2 additions & 2 deletions artifacts/centosstream/centos-stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,10 @@ func (c *centos) Tests() []api.ArtifactTest {
}

// New accepts CentOS Stream 8 and 9 versions.
func New(release string, exampleUserData *docs.UserData, additionalLabels map[string]string) *centos {
func New(release, arch string, exampleUserData *docs.UserData, additionalLabels map[string]string) *centos {
return &centos{
Version: release,
Arch: "x86_64",
Arch: arch,
Variant: "GenericCloud",
getter: &http.HTTPGetter{},
ExampleUserData: exampleUserData,
Expand Down
8 changes: 4 additions & 4 deletions artifacts/fedora/fedora.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,19 +158,19 @@ func (f *fedoraGatherer) releaseMatches(release *Release) bool {
strings.HasSuffix(release.Link, "qcow2")
}

func New(release string, additionalLabels map[string]string) *fedora {
func New(release, arch string, additionalLabels map[string]string) *fedora {
return &fedora{
Version: release,
Arch: "x86_64",
Arch: arch,
Variant: "Cloud",
getter: &http.HTTPGetter{},
AdditionalLabels: additionalLabels,
}
}

func NewGatherer() *fedoraGatherer {
func NewGatherer(arch string) *fedoraGatherer {
return &fedoraGatherer{
Arch: "x86_64",
Arch: arch,
Variant: "Cloud",
getter: &http.HTTPGetter{},
}
Expand Down
4 changes: 2 additions & 2 deletions artifacts/ubuntu/ubuntu.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,10 @@ func (u *ubuntu) Tests() []api.ArtifactTest {
}
}

func New(release string, additionalLabels map[string]string) *ubuntu {
func New(release, arch string, additionalLabels map[string]string) *ubuntu {
return &ubuntu{
Version: release,
Arch: "x86_64",
Arch: arch,
Variant: fmt.Sprintf("ubuntu-%v-server-cloudimg-amd64.img", release),
getter: &http.HTTPGetter{},
AdditionalLabels: additionalLabels,
Expand Down
5 changes: 2 additions & 3 deletions pkg/build/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (

const (
LabelShaSum = "shasum"
ImageArchitecture = "amd64"
)

func ContainerDiskConfig(checksum string, additionalLabels map[string]string) v1.Config {
Expand All @@ -34,7 +33,7 @@ func ContainerDiskConfig(checksum string, additionalLabels map[string]string) v1
return v1.Config{Labels: labels, Env: env}
}

func ContainerDisk(imgPath string, config v1.Config) (v1.Image, error) {
func ContainerDisk(imgPath, imageArchitecture string, config v1.Config) (v1.Image, error) {
img := empty.Image
layer, err := tarball.LayerFromOpener(StreamLayerOpener(imgPath))
if err != nil {
Expand All @@ -52,7 +51,7 @@ func ContainerDisk(imgPath string, config v1.Config) (v1.Image, error) {
}

// Modify the config file
cf.Architecture = ImageArchitecture
cf.Architecture = imageArchitecture
cf.Config = config

img, err = mutate.ConfigFile(img, cf)
Expand Down

0 comments on commit 806f88e

Please sign in to comment.