From 074876d6e98efa35be06eb31d5682b5562ebdafb Mon Sep 17 00:00:00 2001 From: Atanas Dinov Date: Mon, 1 Jul 2024 15:00:35 +0300 Subject: [PATCH] Add elemental sources to artifacts.yaml Signed-off-by: Atanas Dinov --- artifacts.yaml | 4 +++- pkg/eib/eib.go | 16 +++++++++++----- pkg/env/env.go | 8 ++++---- 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/artifacts.yaml b/artifacts.yaml index d313b546..ef977b23 100644 --- a/artifacts.yaml +++ b/artifacts.yaml @@ -6,4 +6,6 @@ endpoint-copier-operator: chart: endpoint-copier-operator repository: https://suse-edge.github.io/charts version: 0.2.0 - +elemental: + register-repository: https://download.opensuse.org/repositories/isv:/Rancher:/Elemental:/Maintenance:/5.5/standard + system-agent-repository: https://download.opensuse.org/repositories/isv:/Rancher:/Elemental:/Maintenance:/5.5/standard diff --git a/pkg/eib/eib.go b/pkg/eib/eib.go index 3a5b79e8..71d4e69b 100644 --- a/pkg/eib/eib.go +++ b/pkg/eib/eib.go @@ -11,7 +11,6 @@ import ( "github.com/suse-edge/edge-image-builder/pkg/build" "github.com/suse-edge/edge-image-builder/pkg/cache" "github.com/suse-edge/edge-image-builder/pkg/combustion" - "github.com/suse-edge/edge-image-builder/pkg/env" "github.com/suse-edge/edge-image-builder/pkg/helm" "github.com/suse-edge/edge-image-builder/pkg/image" "github.com/suse-edge/edge-image-builder/pkg/kubernetes" @@ -72,7 +71,7 @@ func appendKubernetesSELinuxRPMs(ctx *image.Context) error { return fmt.Errorf("identifying selinux repository: %w", err) } - appendRPMs(ctx, repository, selinuxPackage) + appendRPMs(ctx, []image.AddRepo{repository}, selinuxPackage) gpgKeysDir := combustion.GPGKeysPath(ctx) if err = os.MkdirAll(gpgKeysDir, os.ModePerm); err != nil { @@ -98,12 +97,19 @@ func appendElementalRPMs(ctx *image.Context) { log.AuditInfo("Elemental registration is configured. The necessary RPM packages will be downloaded.") - appendRPMs(ctx, image.AddRepo{URL: env.ElementalPackageRepository}, combustion.ElementalPackages...) + appendRPMs(ctx, []image.AddRepo{ + { + URL: ctx.ArtifactSources.Elemental.RegisterRepository, + }, + { + URL: ctx.ArtifactSources.Elemental.SystemAgentRepository, + }, + }, combustion.ElementalPackages...) } -func appendRPMs(ctx *image.Context, repository image.AddRepo, packages ...string) { +func appendRPMs(ctx *image.Context, repos []image.AddRepo, packages ...string) { repositories := ctx.ImageDefinition.OperatingSystem.Packages.AdditionalRepos - repositories = append(repositories, repository) + repositories = append(repositories, repos...) packageList := ctx.ImageDefinition.OperatingSystem.Packages.PKGList packageList = append(packageList, packages...) diff --git a/pkg/env/env.go b/pkg/env/env.go index 19091a9f..779aed16 100644 --- a/pkg/env/env.go +++ b/pkg/env/env.go @@ -1,9 +1,5 @@ package env -var ( - ElementalPackageRepository = "https://download.opensuse.org/repositories/isv:/Rancher:/Elemental:/Maintenance:/5.5/standard/" -) - type ArtifactSources struct { MetalLB struct { Chart string @@ -15,4 +11,8 @@ type ArtifactSources struct { Repository string Version string } + Elemental struct { + RegisterRepository string + SystemAgentRepository string + } }