2 Commits

Author SHA256 Message Date
9e14ce3cc2 Add pre-commit to update release manifest
Some checks failed
Check Release Manifest Local Charts Versions / Check Release Manifest Local Charts Versions (pull_request) Successful in -6s
Build PR in OBS / Build PR in OBS (pull_request_target) Failing after 57m44s
Signed-off-by: Nicolas Belouin <nicolas.belouin@suse.com>
(cherry picked from commit c3f1be5640)
Signed-off-by: Nicolas Belouin <nicolas.belouin@suse.com>
2025-07-30 09:33:48 +02:00
dcb31ca578 add a tool to check local charts version in release manifest
Signed-off-by: Nicolas Belouin <nicolas.belouin@suse.com>
(cherry picked from commit cc8d3fe431)
Signed-off-by: Nicolas Belouin <nicolas.belouin@suse.com>
2025-07-30 09:29:28 +02:00
8 changed files with 158 additions and 41 deletions

View File

@@ -0,0 +1,23 @@
name: Check Release Manifest Local Charts Versions
on:
pull_request:
branches-ignore:
- "devel"
jobs:
sync-pr-project:
name: "Check Release Manifest Local Charts Versions"
runs-on: tumbleweed
steps:
# Waiting on PR to get merged for support in upstream action/checkout action
- uses: 'https://github.com/yangskyboxlabs/action-checkout@sha256'
name: Checkout repository
with:
object-format: 'sha256'
- name: Setup dependencies
run: |
zypper in -y python3-ruamel.yaml
- name: Check release manifest
run: |
python3 .obs/manifest-check.py --check

84
.obs/manifest-check.py Executable file
View File

@@ -0,0 +1,84 @@
#!/usr/bin/python3
import ruamel.yaml
import pathlib
import argparse
import sys
yaml = ruamel.yaml.YAML()
def get_chart_version(chart_name: str) -> str:
with open(f"./{chart_name}/Chart.yaml") as f:
chart = yaml.load(f)
return chart["version"]
def get_charts(chart):
if not chart["chart"].startswith("%%CHART_REPO%%"):
# Not a locally managed chart
return {}
chart_name = chart["chart"][len("%%CHART_REPO%%/%%IMG_PREFIX%%"):]
charts = { chart_name: chart["version"] }
for child_chart in chart.get("dependencyCharts", []) + chart.get("addonCharts", []):
charts.update(get_charts(child_chart))
return charts
def get_charts_list():
with open("./release-manifest-image/release_manifest.yaml") as f:
manifest = yaml.load(f)
charts = {}
for chart in manifest["spec"]["components"]["workloads"]["helm"]:
charts.update(get_charts(chart))
return charts
def check_charts(fix: bool) -> bool:
success = True
charts = get_charts_list()
to_fix = {}
for chart in charts:
expected_version = get_chart_version(chart)
if expected_version != charts[chart]:
success = False
to_fix[f'%%CHART_REPO%%/%%IMG_PREFIX%%{chart}'] = expected_version
print(f"{chart}: Expected: {expected_version}, Got: {charts[chart]}")
if fix and not success:
fix_charts(to_fix)
return True
return success
def fix_charts(to_fix):
manifest_path = pathlib.Path("./release-manifest-image/release_manifest.yaml")
manifest = yaml.load(manifest_path)
yaml.indent(mapping=2, sequence=4, offset=2)
yaml.width = 4096
for chart_index, chart in enumerate(manifest["spec"]["components"]["workloads"]["helm"]):
changed = False
if chart["chart"] in to_fix.keys():
changed = True
chart["version"] = to_fix[chart["chart"]]
for subchart_index, subchart in enumerate(chart.get("addonCharts", [])):
if subchart["chart"] in to_fix.keys():
changed = True
subchart["version"] = to_fix[subchart["chart"]]
chart["addonCharts"][subchart_index] = subchart
for subchart_index, subchart in enumerate(chart.get("dependencyCharts", [])):
if subchart["chart"] in to_fix.keys():
changed = True
subchart["version"] = to_fix[subchart["chart"]]
chart["dependencyCharts"][subchart_index] = subchart
if changed:
manifest["spec"]["components"]["workloads"]["helm"][chart_index] = chart
yaml.dump(manifest, manifest_path)
def main():
print("Checking charts versions in release manifest")
parser = argparse.ArgumentParser()
parser.add_argument('-c', '--check', action='store_true')
args = parser.parse_args()
if not check_charts(not args.check):
sys.exit(1)
else:
print("All local charts in release manifest are using the right version")
if __name__ == "__main__":
main()

10
.pre-commit-config.yaml Normal file
View File

@@ -0,0 +1,10 @@
repos:
- repo: local
hooks:
- id: check-manifest
name: "Check release-manifest"
entry: .obs/manifest-check.py
language: python
additional_dependencies: ['ruamel.yaml']
pass_filenames: false
always_run: true

View File

@@ -1,5 +1,5 @@
#!BuildTag: %%IMG_PREFIX%%edge-image-builder:1.1.2-rc1 #!BuildTag: %%IMG_PREFIX%%edge-image-builder:1.1.1
#!BuildTag: %%IMG_PREFIX%%edge-image-builder:1.1.2-rc1-%RELEASE% #!BuildTag: %%IMG_PREFIX%%edge-image-builder:1.1.1-%RELEASE%
#!BuildVersion: 15.6 #!BuildVersion: 15.6
ARG SLE_VERSION ARG SLE_VERSION
FROM registry.suse.com/bci/bci-base:$SLE_VERSION FROM registry.suse.com/bci/bci-base:$SLE_VERSION
@@ -15,11 +15,11 @@ RUN zypper --non-interactive install --no-recommends edge-image-builder qemu-x86
LABEL org.opencontainers.image.authors="SUSE LLC (https://www.suse.com/)" LABEL org.opencontainers.image.authors="SUSE LLC (https://www.suse.com/)"
LABEL org.opencontainers.image.title="SLE edge-image-builder Container Image" LABEL org.opencontainers.image.title="SLE edge-image-builder Container Image"
LABEL org.opencontainers.image.description="edge-image-builder based on the SLE Base Container Image." LABEL org.opencontainers.image.description="edge-image-builder based on the SLE Base Container Image."
LABEL org.opencontainers.image.version="1.1.2-rc1" LABEL org.opencontainers.image.version="1.1.1"
LABEL org.opencontainers.image.url="https://www.suse.com/products/server/" LABEL org.opencontainers.image.url="https://www.suse.com/products/server/"
LABEL org.opencontainers.image.created="%BUILDTIME%" LABEL org.opencontainers.image.created="%BUILDTIME%"
LABEL org.opencontainers.image.vendor="SUSE LLC" LABEL org.opencontainers.image.vendor="SUSE LLC"
LABEL org.opensuse.reference="%%IMG_REPO%%/%%IMG_PREFIX%%edge-image-builder:1.1.2-rc1-%RELEASE%" LABEL org.opensuse.reference="%%IMG_REPO%%/%%IMG_PREFIX%%edge-image-builder:1.1.1-%RELEASE%"
LABEL org.openbuildservice.disturl="%DISTURL%" LABEL org.openbuildservice.disturl="%DISTURL%"
LABEL com.suse.supportlevel="%%SUPPORT_LEVEL%%" LABEL com.suse.supportlevel="%%SUPPORT_LEVEL%%"
LABEL com.suse.eula="SUSE Combined EULA February 2024" LABEL com.suse.eula="SUSE Combined EULA February 2024"

View File

@@ -3,11 +3,11 @@
<param name="url">https://github.com/suse-edge/edge-image-builder.git</param> <param name="url">https://github.com/suse-edge/edge-image-builder.git</param>
<param name="scm">git</param> <param name="scm">git</param>
<param name="exclude">.git</param> <param name="exclude">.git</param>
<param name="revision">v1.1.2-rc1</param> <param name="revision">v1.1.1</param>
<!-- Uncomment and set this For Pre-Release Version --> <!-- Uncomment and set this For Pre-Release Version -->
<param name="version">1.1.2~rc0</param> <!-- <param name="version">1.1.1~rc0</param> -->
<!-- Uncomment and this for regular version --> <!-- Uncomment and this for regular version -->
<!-- <param name="versionformat">@PARENT_TAG@</param> --> <param name="versionformat">@PARENT_TAG@</param>
<param name="versionrewrite-pattern">v(\d+).(\d+).(\d+)</param> <param name="versionrewrite-pattern">v(\d+).(\d+).(\d+)</param>
<param name="versionrewrite-replacement">\1.\2.\3</param> <param name="versionrewrite-replacement">\1.\2.\3</param>
<param name="changesgenerate">enable</param> <param name="changesgenerate">enable</param>

View File

@@ -17,7 +17,7 @@
Name: edge-image-builder Name: edge-image-builder
Version: 1.1.2~rc1 Version: 1.1.1
Release: 0 Release: 0
Summary: Edge Image Builder Summary: Edge Image Builder
License: Apache-2.0 License: Apache-2.0

View File

@@ -1,4 +1,4 @@
#!BuildTag: %%IMG_PREFIX%%release-manifest:3.2.2 #!BuildTag: %%IMG_PREFIX%%release-manifest:3.2.1
ARG SLE_VERSION ARG SLE_VERSION
FROM registry.suse.com/bci/bci-micro:$SLE_VERSION FROM registry.suse.com/bci/bci-micro:$SLE_VERSION
@@ -7,11 +7,11 @@ FROM registry.suse.com/bci/bci-micro:$SLE_VERSION
LABEL org.opencontainers.image.authors="SUSE LLC (https://www.suse.com/)" LABEL org.opencontainers.image.authors="SUSE LLC (https://www.suse.com/)"
LABEL org.opencontainers.image.title="SUSE Edge Release Manifest" LABEL org.opencontainers.image.title="SUSE Edge Release Manifest"
LABEL org.opencontainers.image.description="Release Manifest containing information about a specific SUSE Edge release" LABEL org.opencontainers.image.description="Release Manifest containing information about a specific SUSE Edge release"
LABEL org.opencontainers.image.version="3.2.2" LABEL org.opencontainers.image.version="3.2.1"
LABEL org.opencontainers.image.url="https://www.suse.com/solutions/edge-computing/" LABEL org.opencontainers.image.url="https://www.suse.com/solutions/edge-computing/"
LABEL org.opencontainers.image.created="%BUILDTIME%" LABEL org.opencontainers.image.created="%BUILDTIME%"
LABEL org.opencontainers.image.vendor="SUSE LLC" LABEL org.opencontainers.image.vendor="SUSE LLC"
LABEL org.opensuse.reference="%%IMG_REPO%%/%%IMG_PREFIX%%release-manifest:3.2.2" LABEL org.opensuse.reference="%%IMG_REPO%%/%%IMG_PREFIX%%release-manifest:3.2.1"
LABEL org.openbuildservice.disturl="%DISTURL%" LABEL org.openbuildservice.disturl="%DISTURL%"
LABEL com.suse.supportlevel="%%SUPPORT_LEVEL%%" LABEL com.suse.supportlevel="%%SUPPORT_LEVEL%%"
LABEL com.suse.eula="SUSE Combined EULA February 2024" LABEL com.suse.eula="SUSE Combined EULA February 2024"

View File

@@ -1,9 +1,9 @@
apiVersion: lifecycle.suse.com/v1alpha1 apiVersion: lifecycle.suse.com/v1alpha1
kind: ReleaseManifest kind: ReleaseManifest
metadata: metadata:
name: release-manifest-3-2-2 name: release-manifest-3-2-1
spec: spec:
releaseVersion: 3.2.2 releaseVersion: 3.2.1
components: components:
kubernetes: kubernetes:
k3s: k3s:
@@ -76,13 +76,13 @@ spec:
version: 0.0.0 version: 0.0.0
type: HelmChart type: HelmChart
operatingSystem: operatingSystem:
version: "6.0" version: '6.0'
zypperID: "SL-Micro" zypperID: SL-Micro
cpeScheme: "cpe:/o:suse:sl-micro:6.0" cpeScheme: cpe:/o:suse:sl-micro:6.0
prettyName: "SUSE Linux Micro 6.0" prettyName: SUSE Linux Micro 6.0
supportedArchs: supportedArchs:
- "x86_64" - x86_64
- "aarch64" - aarch64
workloads: workloads:
helm: helm:
- prettyName: Rancher - prettyName: Rancher
@@ -105,20 +105,20 @@ spec:
repository: https://charts.rancher.io repository: https://charts.rancher.io
- prettyName: MetalLB - prettyName: MetalLB
releaseName: metallb releaseName: metallb
chart: %%CHART_REPO%%/%%IMG_PREFIX%%metallb-chart chart: '%%CHART_REPO%%/%%IMG_PREFIX%%metallb-chart'
version: %%CHART_MAJOR%%.0.1+up0.14.9 version: '%%CHART_MAJOR%%.0.1+up0.14.9'
- prettyName: CDI - prettyName: CDI
releaseName: cdi releaseName: cdi
chart: %%CHART_REPO%%/%%IMG_PREFIX%%cdi-chart chart: '%%CHART_REPO%%/%%IMG_PREFIX%%cdi-chart'
version: %%CHART_MAJOR%%.0.0+up0.4.0 version: '%%CHART_MAJOR%%.0.0+up0.4.0'
- prettyName: KubeVirt - prettyName: KubeVirt
releaseName: kubevirt releaseName: kubevirt
chart: %%CHART_REPO%%/%%IMG_PREFIX%%kubevirt-chart chart: '%%CHART_REPO%%/%%IMG_PREFIX%%kubevirt-chart'
version: %%CHART_MAJOR%%.0.0+up0.4.0 version: '%%CHART_MAJOR%%.0.0+up0.4.0'
addonCharts: addonCharts:
- releaseName: kubevirt-dashboard-extension - releaseName: kubevirt-dashboard-extension
chart: %%CHART_REPO%%/%%IMG_PREFIX%%kubevirt-dashboard-extension-chart chart: '%%CHART_REPO%%/%%IMG_PREFIX%%kubevirt-dashboard-extension-chart'
version: %%CHART_MAJOR%%.0.0+up1.2.1 version: '%%CHART_MAJOR%%.0.0+up1.2.1'
- prettyName: NeuVector - prettyName: NeuVector
releaseName: neuvector releaseName: neuvector
chart: neuvector chart: neuvector
@@ -136,8 +136,8 @@ spec:
version: 2.0.1 version: 2.0.1
- prettyName: EndpointCopierOperator - prettyName: EndpointCopierOperator
releaseName: endpoint-copier-operator releaseName: endpoint-copier-operator
chart: %%CHART_REPO%%/%%IMG_PREFIX%%endpoint-copier-operator-chart chart: '%%CHART_REPO%%/%%IMG_PREFIX%%endpoint-copier-operator-chart'
version: %%CHART_MAJOR%%.0.0+up0.2.1 version: '%%CHART_MAJOR%%.0.0+up0.2.1'
- prettyName: Elemental - prettyName: Elemental
releaseName: elemental-operator releaseName: elemental-operator
chart: oci://registry.suse.com/rancher/elemental-operator-chart chart: oci://registry.suse.com/rancher/elemental-operator-chart
@@ -153,25 +153,25 @@ spec:
version: 3.0.0 version: 3.0.0
- prettyName: SRIOV - prettyName: SRIOV
releaseName: sriov-network-operator releaseName: sriov-network-operator
chart: %%CHART_REPO%%/%%IMG_PREFIX%%sriov-network-operator-chart chart: '%%CHART_REPO%%/%%IMG_PREFIX%%sriov-network-operator-chart'
version: %%CHART_MAJOR%%.0.0+up1.4.0 version: '%%CHART_MAJOR%%.0.0+up1.4.0'
dependencyCharts: dependencyCharts:
- releaseName: sriov-crd - releaseName: sriov-crd
chart: %%CHART_REPO%%/%%IMG_PREFIX%%sriov-crd-chart chart: '%%CHART_REPO%%/%%IMG_PREFIX%%sriov-crd-chart'
version: %%CHART_MAJOR%%.0.0+up1.4.0 version: '%%CHART_MAJOR%%.0.0+up1.4.0'
- prettyName: Akri - prettyName: Akri
releaseName: akri releaseName: akri
chart: %%CHART_REPO%%/%%IMG_PREFIX%%akri-chart chart: '%%CHART_REPO%%/%%IMG_PREFIX%%akri-chart'
version: %%CHART_MAJOR%%.0.0+up0.12.20 version: '%%CHART_MAJOR%%.0.0+up0.12.20'
addonCharts: addonCharts:
- releaseName: akri-dashboard-extension - releaseName: akri-dashboard-extension
chart: %%CHART_REPO%%/%%IMG_PREFIX%%akri-dashboard-extension-chart chart: '%%CHART_REPO%%/%%IMG_PREFIX%%akri-dashboard-extension-chart'
version: %%CHART_MAJOR%%.0.0+up1.2.1 version: '%%CHART_MAJOR%%.0.0+up1.2.1'
- prettyName: Metal3 - prettyName: Metal3
releaseName: metal3 releaseName: metal3
chart: %%CHART_REPO%%/%%IMG_PREFIX%%metal3-chart chart: '%%CHART_REPO%%/%%IMG_PREFIX%%metal3-chart'
version: %%CHART_MAJOR%%.0.1+up0.9.4 version: '%%CHART_MAJOR%%.0.1+up0.9.4'
- prettyName: RancherTurtles - prettyName: RancherTurtles
releaseName: rancher-turtles releaseName: rancher-turtles
chart: %%CHART_REPO%%/%%IMG_PREFIX%%rancher-turtles-chart chart: '%%CHART_REPO%%/%%IMG_PREFIX%%rancher-turtles-chart'
version: %%CHART_MAJOR%%.0.0+up0.14.1 version: '%%CHART_MAJOR%%.0.0+up0.14.1'