From 8b289582c0f7cd2b59d98b023b7592972d3feed8 Mon Sep 17 00:00:00 2001 From: "Jose D. Gomez R" <1josegomezr@gmail.com> Date: Tue, 12 Nov 2024 21:56:56 +0100 Subject: [PATCH] Support arbitrary registration URL Add support for `operatingSystem.packages.sccRegistrationUrl` to allow for registration against an RMT/SMT/SUMA. --- pkg/image/definition.go | 1 + pkg/rpm/resolver/resolver.go | 2 ++ pkg/rpm/resolver/templates/rpm-resolution.sh.tpl | 2 +- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/image/definition.go b/pkg/image/definition.go index acf4ce8a..5010acc2 100644 --- a/pkg/image/definition.go +++ b/pkg/image/definition.go @@ -127,6 +127,7 @@ type Packages struct { PKGList []string `yaml:"packageList"` AdditionalRepos []AddRepo `yaml:"additionalRepos"` RegCode string `yaml:"sccRegistrationCode"` + RegUrl string `yaml:"sccRegistrationUrl"` } type AddRepo struct { diff --git a/pkg/rpm/resolver/resolver.go b/pkg/rpm/resolver/resolver.go index 7ad98adb..c9f91afc 100644 --- a/pkg/rpm/resolver/resolver.go +++ b/pkg/rpm/resolver/resolver.go @@ -182,6 +182,7 @@ func (r *Resolver) prepareLocalRPMs(localRPMConfig *image.LocalRPMConfig) error func (r *Resolver) writeRPMResolutionScript(localRPMConfig *image.LocalRPMConfig, packages *image.Packages) error { values := struct { RegCode string + RegUrl string AddRepo []image.AddRepo CacheDir string PKGList string @@ -191,6 +192,7 @@ func (r *Resolver) writeRPMResolutionScript(localRPMConfig *image.LocalRPMConfig Arch string }{ RegCode: packages.RegCode, + RegUrl: packages.RegUrl, AddRepo: packages.AdditionalRepos, CacheDir: r.generateResolverImgRPMRepoPath(), NoGPGCheck: packages.NoGPGCheck, diff --git a/pkg/rpm/resolver/templates/rpm-resolution.sh.tpl b/pkg/rpm/resolver/templates/rpm-resolution.sh.tpl index ae1c9196..c6b3220e 100644 --- a/pkg/rpm/resolver/templates/rpm-resolution.sh.tpl +++ b/pkg/rpm/resolver/templates/rpm-resolution.sh.tpl @@ -12,7 +12,7 @@ set -euo pipefail # Arch - sets the architecture of the rpm packages to pull {{ if ne .RegCode "" }} -suseconnect -r {{ .RegCode }} +suseconnect -r {{ .RegCode }} {{- with .RegUrl }} --url "{{ . }}" {{- end }} zypper ref trap "suseconnect -d" EXIT {{ end -}}