Skip to content

Commit

Permalink
Fix missing extensions in RHCOS release browser for 4.16+
Browse files Browse the repository at this point in the history
- Fix an issue where extensions were not displayed in
the RHCOS release browser for versions 4.16 and later.

Signed-off-by: Renata Ravanelli <[email protected]>
(cherry picked from commit 7122058)
  • Loading branch information
ravanelli committed Feb 3, 2025
1 parent 2765690 commit a62de1f
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
28 changes: 27 additions & 1 deletion cmd/build-extensions-container.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,34 @@ func buildExtensionContainer() error {
SizeInBytes: float64(stat.Size()),
SkipCompression: true,
}
cosaBuild.MetaStamp = float64(time.Now().UnixNano())
fmt.Printf("Generating meta.json `extensions` entry for: %s\n", buildID)
// The /tmp/extensions.json file is generated as part of the extension container build process.
// For more details, refer to:
// https://github.com/openshift/os/blob/master/extensions/Dockerfile
extensionsFilePath:= "./tmp/extensions.json"
fileContent, err := os.ReadFile(extensionsFilePath)
if err != nil {
fmt.Printf("Error reading JSON file: %v\n", err)
return err
}
// Parse the JSON content into a map
packages := make(map[string]string)
err = json.Unmarshal(fileContent, &packages)
if err != nil {
fmt.Printf("Error parsing JSON content: %v\n", err)
return err
}

// Convert to extensionsInterfaceMap
extensionsInterfaceMap := make(map[string]interface{})
for key, value := range packages {
extensionsInterfaceMap[key] = value
}

cosaBuild.Extensions = &cosa.Extensions {
Manifest: extensionsInterfaceMap,
}
cosaBuild.MetaStamp = float64(time.Now().UnixNano())
newBytes, err := json.MarshalIndent(cosaBuild, "", " ")
if err != nil {
return err
Expand Down
2 changes: 2 additions & 0 deletions src/build-extensions-container.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ if [[ -f "${workdir}/src/config.json" ]]; then
fi

mkdir "${ctx_dir}/hotfixes"
touch "${workdir}/tmp/extensions.json"
tar -xC "${ctx_dir}/hotfixes" -f /dev/disk/by-id/virtio-hotfixes

# Build the image, replacing the FROM directive with the local image we have.
Expand All @@ -33,6 +34,7 @@ img=localhost/extensions-container
(set -x; podman build --from oci-archive:"$ostree_ociarchive" --network=host \
--build-arg COSA=true --build-arg VARIANT="${variant}" --label version="$buildid" \
--volume /etc/pki/ca-trust:/etc/pki/ca-trust:ro \
--volume "${workdir}"/tmp/extensions.json:/tmp/extensions.json \
-t "${img}" -f extensions/Dockerfile "${ctx_dir}")

# Call skopeo to export it from the container storage to an oci-archive.
Expand Down

0 comments on commit a62de1f

Please sign in to comment.