Drop common.CurrentArch() in favor of osbuild/images

Drop `common.CurrentArch()` implementation and use
`arch.Current().String()` from the osbuild/images instead.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
This commit is contained in:
Tomáš Hozza 2024-01-19 21:05:46 +01:00 committed by Achilleas Koutsou
parent c4e5ab5aca
commit 43e87632fb
11 changed files with 20 additions and 73 deletions

View file

@ -15,6 +15,7 @@ import (
"path/filepath"
"strings"
"github.com/osbuild/images/pkg/arch"
"github.com/osbuild/images/pkg/container"
"github.com/osbuild/images/pkg/distro"
"github.com/osbuild/images/pkg/osbuild"
@ -27,7 +28,6 @@ import (
"github.com/osbuild/osbuild-composer/internal/cloud/awscloud"
"github.com/osbuild/osbuild-composer/internal/cloud/gcp"
"github.com/osbuild/osbuild-composer/internal/common"
"github.com/osbuild/osbuild-composer/internal/target"
"github.com/osbuild/osbuild-composer/internal/upload/azure"
"github.com/osbuild/osbuild-composer/internal/upload/koji"
@ -349,7 +349,7 @@ func (impl *OSBuildJobImpl) Run(job worker.Job) error {
Success: false,
},
UploadStatus: "failure",
Arch: common.CurrentArch(),
Arch: arch.Current().String(),
}
hostOS, err := distro.GetHostDistroName()
@ -627,7 +627,7 @@ func (impl *OSBuildJobImpl) Run(job worker.Job) error {
break
}
ami, err := a.Register(jobTarget.ImageName, bucket, targetOptions.Key, targetOptions.ShareWithAccounts, common.CurrentArch(), targetOptions.BootMode)
ami, err := a.Register(jobTarget.ImageName, bucket, targetOptions.Key, targetOptions.ShareWithAccounts, arch.Current().String(), targetOptions.BootMode)
if err != nil {
targetResult.TargetError = clienterrors.WorkerClientError(clienterrors.ErrorImportingImage, err.Error(), nil)
break

View file

@ -20,7 +20,7 @@ import (
"github.com/aws/aws-sdk-go/service/autoscaling"
"github.com/sirupsen/logrus"
"github.com/osbuild/osbuild-composer/internal/common"
"github.com/osbuild/images/pkg/arch"
"github.com/osbuild/osbuild-composer/internal/dnfjson"
"github.com/osbuild/osbuild-composer/internal/upload/azure"
"github.com/osbuild/osbuild-composer/internal/upload/koji"
@ -161,7 +161,7 @@ func setProtection(protected bool) {
// Returning an error here will result in the worker backing off for a while and retrying
func RequestAndRunJob(client *worker.Client, acceptedJobTypes []string, jobImpls map[string]JobImplementation) error {
logrus.Debug("Waiting for a new job...")
job, err := client.RequestJob(acceptedJobTypes, common.CurrentArch())
job, err := client.RequestJob(acceptedJobTypes, arch.Current().String())
if err == worker.ErrClientRequestJobTimeout {
logrus.Debugf("Requesting job timed out: %v", err)
return nil