Skip to content

Commit 24a9230

Browse files
committed
Fix missing extensions in RHCOS release browser for 4.16+
- 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)
1 parent 6767d76 commit 24a9230

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

cmd/build-extensions-container.go

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,34 @@ func buildExtensionContainer() error {
185185
SizeInBytes: float64(stat.Size()),
186186
SkipCompression: true,
187187
}
188-
cosaBuild.MetaStamp = float64(time.Now().UnixNano())
188+
fmt.Printf("Generating meta.json `extensions` entry for: %s\n", buildID)
189+
// The /tmp/extensions.json file is generated as part of the extension container build process.
190+
// For more details, refer to:
191+
// https://github.com/openshift/os/blob/master/extensions/Dockerfile
192+
extensionsFilePath:= "./tmp/extensions.json"
193+
fileContent, err := os.ReadFile(extensionsFilePath)
194+
if err != nil {
195+
fmt.Printf("Error reading JSON file: %v\n", err)
196+
return err
197+
}
198+
// Parse the JSON content into a map
199+
packages := make(map[string]string)
200+
err = json.Unmarshal(fileContent, &packages)
201+
if err != nil {
202+
fmt.Printf("Error parsing JSON content: %v\n", err)
203+
return err
204+
}
205+
206+
// Convert to extensionsInterfaceMap
207+
extensionsInterfaceMap := make(map[string]interface{})
208+
for key, value := range packages {
209+
extensionsInterfaceMap[key] = value
210+
}
189211

212+
cosaBuild.Extensions = &cosa.Extensions {
213+
Manifest: extensionsInterfaceMap,
214+
}
215+
cosaBuild.MetaStamp = float64(time.Now().UnixNano())
190216
newBytes, err := json.MarshalIndent(cosaBuild, "", " ")
191217
if err != nil {
192218
return err

src/build-extensions-container.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ if [[ -f "${workdir}/src/config.json" ]]; then
2424
fi
2525

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

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

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

0 commit comments

Comments
 (0)