go.mod: update osbuild/images to v0.143.0

tag v0.142.0
Tagger: imagebuilder-bot <imagebuilder-bots+imagebuilder-bot@redhat.com>

Changes with 0.142.0

----------------
  * distro: move `kernelOptions` into `ImageConfig` (osbuild/images#1470)
    * Author: Michael Vogt, Reviewers: Achilleas Koutsou, Tomáš Hozza
  * manifest: register insights to template on boot (HMS-5994) (osbuild/images#1443)
    * Author: rverdile, Reviewers: Achilleas Koutsou, Tomáš Hozza
  * many: add custom unmarshalers for osbuild, platform (osbuild/images#1477)
    * Author: Michael Vogt, Reviewers: Achilleas Koutsou, Tomáš Hozza

— Somewhere on the Internet, 2025-05-05

---

tag v0.143.0
Tagger: imagebuilder-bot <imagebuilder-bots+imagebuilder-bot@redhat.com>

Changes with 0.143.0

----------------
  * distro/rhel9/azure: drop net.ifnames=0 kernel arg (RHEL-89440) (osbuild/images#1487)
    * Author: Achilleas Koutsou, Reviewers: Michael Vogt, Sanne Raymaekers
  * github: don't run manifest checksum validation on the merge queue (osbuild/images#1478)
    * Author: Achilleas Koutsou, Reviewers: Brian C. Lane, Florian Schüller
  * repositories: Set 6h expire on main repo, use default for updates (osbuild/images#1482)
    * Author: Brian C. Lane, Reviewers: Achilleas Koutsou, Neal Gompa (ニール・ゴンパ), Simon de Vlieger

— Somewhere on the Internet, 2025-05-05

---
This commit is contained in:
Achilleas Koutsou 2025-05-06 01:25:50 +03:00 committed by Sanne Raymaekers
parent 1a6c70b649
commit 943e147a67
43 changed files with 252 additions and 163 deletions

View file

@ -3,6 +3,7 @@ package manifest
import (
"fmt"
"path/filepath"
"strings"
"github.com/osbuild/images/pkg/customizations/fsnode"
"github.com/osbuild/images/pkg/customizations/subscription"
@ -116,12 +117,24 @@ func subscriptionService(subscriptionOptions subscription.ImageOptions, serviceO
var commands []string
if subscriptionOptions.Rhc {
var curlToAssociateSystem string
// Use rhc for registration instead of subscription manager
commands = []string{fmt.Sprintf("/usr/bin/rhc connect --organization=${ORG_ID} --activation-key=${ACTIVATION_KEY} --server %s", subscriptionOptions.ServerUrl)}
rhcConnect := fmt.Sprintf("/usr/bin/rhc connect --organization=${ORG_ID} --activation-key=${ACTIVATION_KEY} --server %s", subscriptionOptions.ServerUrl)
if subscriptionOptions.TemplateUUID != "" {
curlToAssociateSystem = getCurlToAssociateSystem(subscriptionOptions)
} else if subscriptionOptions.TemplateName != "" {
rhcConnect += fmt.Sprintf(" --content-template %s", subscriptionOptions.TemplateName)
}
commands = append(commands, rhcConnect)
// insights-client creates the .gnupg directory during boot process, and is labeled incorrectly
commands = append(commands, "restorecon -R /root/.gnupg")
// execute the rhc post install script as the selinuxenabled check doesn't work in the buildroot container
commands = append(commands, "/usr/sbin/semanage permissive --add rhcd_t")
// register to template if template uuid is specified
if curlToAssociateSystem != "" {
commands = append(commands, curlToAssociateSystem)
commands = append(commands, "/usr/sbin/subscription-manager refresh")
}
if insightsOnBoot {
icDir, icFile, err := runInsightsClientOnBoot()
if err != nil {
@ -138,6 +151,12 @@ func subscriptionService(subscriptionOptions subscription.ImageOptions, serviceO
commands = append(commands, "/usr/bin/insights-client --register")
// insights-client creates the .gnupg directory during boot process, and is labeled incorrectly
commands = append(commands, "restorecon -R /root/.gnupg")
// register to template if template is specified
if subscriptionOptions.TemplateUUID != "" {
curlToAssociateSystem := getCurlToAssociateSystem(subscriptionOptions)
commands = append(commands, curlToAssociateSystem)
commands = append(commands, "/usr/sbin/subscription-manager refresh")
}
if insightsOnBoot {
icDir, icFile, err := runInsightsClientOnBoot()
if err != nil {
@ -229,3 +248,13 @@ ExecStartPre=
WantedBy=multi-user.target
`
}
func getCurlToAssociateSystem(subscriptionOptions subscription.ImageOptions) string {
patchURL := strings.TrimSuffix(subscriptionOptions.PatchURL, "/")
addTemplateURL := fmt.Sprintf("%s/templates/%s/subscribed-systems", patchURL, subscriptionOptions.TemplateUUID)
curlToAssociateSystem := fmt.Sprintf("curl -v --retry 5 --cert /etc/pki/consumer/cert.pem --key /etc/pki/consumer/key.pem -X PATCH %s", addTemplateURL)
if subscriptionOptions.Proxy != "" {
curlToAssociateSystem += fmt.Sprintf(" --proxy %s", subscriptionOptions.Proxy)
}
return curlToAssociateSystem
}