Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add supported platforms #22

Merged
merged 4 commits into from
Aug 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions channels/sl-micro-60-baremetal.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"type": "container",
"metadata": {
"upgradeImage": "registry.suse.com/suse/sl-micro/6.0/baremetal-os-container:2.1.1-3.29",
"displayName": "SL Micro 6.0 OS"
"displayName": "SL Micro 6.0 OS",
"platforms": ["linux/x86_64","linux/aarch64"]
}
}
},
Expand All @@ -21,7 +22,8 @@
"type": "iso",
"metadata": {
"uri": "registry.suse.com/suse/sl-micro/6.0/baremetal-iso-image:2.1.1-3.36",
"displayName": "SL Micro 6.0 ISO"
"displayName": "SL Micro 6.0 ISO",
"platforms": ["linux/x86_64","linux/aarch64"]
}
}
}
Expand Down
6 changes: 4 additions & 2 deletions channels/sl-micro-60-base.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"type": "container",
"metadata": {
"upgradeImage": "registry.suse.com/suse/sl-micro/6.0/base-os-container:2.1.1-3.18",
"displayName": "SL Micro Base 6.0 OS"
"displayName": "SL Micro Base 6.0 OS",
"platforms": ["linux/x86_64","linux/aarch64"]
}
}
},
Expand All @@ -21,7 +22,8 @@
"type": "iso",
"metadata": {
"uri": "registry.suse.com/suse/sl-micro/6.0/base-iso-image:2.1.1-2.47",
"displayName": "SL Micro Base 6.0 ISO"
"displayName": "SL Micro Base 6.0 ISO",
"platforms": ["linux/x86_64","linux/aarch64"]
}
}
}
Expand Down
6 changes: 4 additions & 2 deletions channels/sl-micro-60-kvm.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"type": "container",
"metadata": {
"upgradeImage": "registry.suse.com/suse/sl-micro/6.0/kvm-os-container:2.1.1-3.34",
"displayName": "SL Micro KVM 6.0 OS"
"displayName": "SL Micro KVM 6.0 OS",
"platforms": ["linux/x86_64","linux/aarch64"]
}
}
},
Expand All @@ -21,7 +22,8 @@
"type": "iso",
"metadata": {
"uri": "registry.suse.com/suse/sl-micro/6.0/kvm-iso-image:2.1.1-3.46",
"displayName": "SL Micro KVM 6.0 ISO"
"displayName": "SL Micro KVM 6.0 ISO",
"platforms": ["linux/x86_64","linux/aarch64"]
}
}
}
Expand Down
6 changes: 4 additions & 2 deletions channels/sl-micro-60-rt.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"type": "container",
"metadata": {
"upgradeImage": "registry.suse.com/suse/sl-micro/6.0/rt-os-container:2.1.1-4.1",
"displayName": "SL Micro RT 6.0 OS"
"displayName": "SL Micro RT 6.0 OS",
"platforms": ["linux/x86_64"]
}
}
},
Expand All @@ -21,7 +22,8 @@
"type": "iso",
"metadata": {
"uri": "registry.suse.com/suse/sl-micro/6.0/rt-iso-image:2.1.1-3.29",
"displayName": "SL Micro RT 6.0 ISO"
"displayName": "SL Micro RT 6.0 ISO",
"platforms": ["linux/x86_64"]
}
}
}
Expand Down
23 changes: 18 additions & 5 deletions refresh_channels.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ function append_os_entry() {
local version=$3
local image_uri=$4
local display_name=$5
local platforms=$6
cat >> "$file" << EOF
{
"metadata": {
Expand All @@ -31,7 +32,8 @@ function append_os_entry() {
"type": "container",
"metadata": {
"upgradeImage": "$image_uri",
"displayName": "$display_name OS"
"displayName": "$display_name OS",
"platforms": $platforms
}
}
},
Expand All @@ -45,6 +47,7 @@ function append_iso_entry() {
local version=$3
local image_uri=$4
local display_name=$5
local platforms=$6
cat >> "$file" << EOF
{
"metadata": {
Expand All @@ -55,7 +58,8 @@ function append_iso_entry() {
"type": "iso",
"metadata": {
"uri": "$image_uri",
"displayName": "$display_name ISO"
"displayName": "$display_name ISO",
"platforms": $platforms
}
}
},
Expand Down Expand Up @@ -84,11 +88,12 @@ function process_intermediate_list() {
local version=$(echo "$entry" | jq '.version' | sed 's/"//g')
local managed_os_version_name=$(echo "$entry" | jq '.managedOSVersionName' | sed 's/"//g')
local display_name=$(echo "$entry" | jq '.displayName' | sed 's/"//g')
local platforms=$(echo "$entry" | jq -c '[.platforms[]]')

if [[ "$type" == "os" ]]; then
append_os_entry "$file" "$managed_os_version_name" "$version" "$image_uri" "$display_name"
append_os_entry "$file" "$managed_os_version_name" "$version" "$image_uri" "$display_name" "$platforms"
elif [[ "$type" == "iso" ]]; then
append_iso_entry "$file" "$managed_os_version_name" "$version" "$image_uri" "$display_name"
append_iso_entry "$file" "$managed_os_version_name" "$version" "$image_uri" "$display_name" "$platforms"
fi
done
}
Expand Down Expand Up @@ -121,9 +126,17 @@ function process_repo() {
fi
local image_uri="$repo:$tag"
local image_creation_date=($(skopeo inspect docker://$image_uri | jq '.Created' | sed 's/"//g'))
local raw_inspect_output=$(skopeo inspect --raw docker://$image_uri)
# If there is no list of platforms, assume only the one that runs this script is available.
local platforms="[\"amd64\"]"
if echo "$raw_inspect_output" | jq '.manifests | length > 0' | grep "true" > /dev/null; then
platforms=$(echo "$raw_inspect_output" | jq -c '[.manifests[].platform.architecture]')
fi
platforms="${platforms/amd64/linux\/x86_64}"
platforms="${platforms/arm64/linux\/aarch64}"
local managed_os_version_name=$(format_managed_os_version_name "$flavor" "$tag" "$repo_type")
# Append entry to intermediate list
local intermediate_entry="{\"uri\":\"$image_uri\",\"created\":\"$image_creation_date\",\"version\":\"$tag\",\"managedOSVersionName\":\"$managed_os_version_name\",\"displayName\":\"$display_name\"}"
local intermediate_entry="{\"uri\":\"$image_uri\",\"created\":\"$image_creation_date\",\"version\":\"$tag\",\"managedOSVersionName\":\"$managed_os_version_name\",\"displayName\":\"$display_name\",\"platforms\":$platforms}"
echo "Intermediate: $intermediate_entry"
local intermediate_list=("${intermediate_list[@]}" "$intermediate_entry")
done
Expand Down