Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package python-flux-local for 
openSUSE:Factory checked in at 2024-11-13 15:28:26
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-flux-local (Old)
 and      /work/SRC/openSUSE:Factory/.python-flux-local.new.2017 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-flux-local"

Wed Nov 13 15:28:26 2024 rev:2 rq:1223738 version:6.0.2

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-flux-local/python-flux-local.changes      
2024-10-23 21:11:27.069627472 +0200
+++ 
/work/SRC/openSUSE:Factory/.python-flux-local.new.2017/python-flux-local.changes
    2024-11-13 15:28:53.214780072 +0100
@@ -1,0 +2,21 @@
+Tue Nov 12 08:47:09 UTC 2024 - Johannes Kastl 
<opensuse_buildserv...@ojkastl.de>
+
+- update to 0.6.2:
+  * What's Changed
+    - Strip attributes in List resources by @allenporter in #802
+  * Developer updates
+    - chore(deps): update dependency pytest-cov to v6 by @renovate
+      in #800
+
+-------------------------------------------------------------------
+Tue Nov 12 08:40:26 UTC 2024 - Johannes Kastl 
<opensuse_buildserv...@ojkastl.de>
+
+- update to 6.0.1:
+  * What's Changed
+    - Set unique placeholder values for each substitution by
+      @allenporter in #801
+  * Developer updates
+    - chore(deps): update dependency pdoc to v15 by @renovate in
+      #799
+
+-------------------------------------------------------------------

Old:
----
  flux_local-6.0.0.tar.gz

New:
----
  flux_local-6.0.2.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-flux-local.spec ++++++
--- /var/tmp/diff_new_pack.E6wpS8/_old  2024-11-13 15:28:53.726801458 +0100
+++ /var/tmp/diff_new_pack.E6wpS8/_new  2024-11-13 15:28:53.726801458 +0100
@@ -18,7 +18,7 @@
 
 %{?sle15_python_module_pythons}
 Name:           python-flux-local
-Version:        6.0.0
+Version:        6.0.2
 Release:        0
 Summary:        Set of tools for managing a flux gitops repository
 License:        Apache-2.0
@@ -30,7 +30,7 @@
 BuildRequires:  %{python_module wheel}
 BuildRequires:  %{python_module aiofiles >= 22.1.0}
 BuildRequires:  %{python_module GitPython >= 3.1.30}
-BuildRequires:  %{python_module mashumaro >= 3.12}
+BuildRequires:  %{python_module mashumaro >= 3.14}
 BuildRequires:  %{python_module nest-asyncio >= 1.5.6}
 BuildRequires:  %{python_module PyYAML >= 6.0}
 BuildRequires:  %{python_module python-slugify >= 8.0.0}
@@ -41,7 +41,7 @@
 BuildRequires:  fdupes
 Requires:       python-aiofiles >= 22.1.0
 Requires:       python-GitPython >= 3.1.30
-Requires:       python-mashumaro >= 3.12
+Requires:       python-mashumaro >= 3.14
 Requires:       python-nest-asyncio >= 1.5.6
 Requires:       python-python-slugify >= 8.0.0
 Requires:       python-PyYAML >= 6.0

++++++ flux_local-6.0.0.tar.gz -> flux_local-6.0.2.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/flux_local-6.0.0/PKG-INFO 
new/flux_local-6.0.2/PKG-INFO
--- old/flux_local-6.0.0/PKG-INFO       2024-10-08 16:32:21.947679800 +0200
+++ new/flux_local-6.0.2/PKG-INFO       2024-11-10 19:31:17.995438000 +0100
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: flux-local
-Version: 6.0.0
+Version: 6.0.2
 Summary: flux-local is a python library and set of tools for managing a flux 
gitops repository, with validation steps to help improve quality of commits, 
PRs, and general local testing.
 Home-page: https://github.com/allenporter/flux-local
 Author: Allen Porter
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/flux_local-6.0.0/flux_local/manifest.py 
new/flux_local-6.0.2/flux_local/manifest.py
--- old/flux_local-6.0.0/flux_local/manifest.py 2024-10-08 16:32:16.000000000 
+0200
+++ new/flux_local-6.0.2/flux_local/manifest.py 2024-11-10 19:31:14.000000000 
+0100
@@ -47,8 +47,7 @@
 SECRET_KIND = "Secret"
 CONFIG_MAP_KIND = "ConfigMap"
 DEFAULT_NAMESPACE = "flux-system"
-VALUE_PLACEHOLDER = "..PLACEHOLDER.."
-VALUE_B64_PLACEHOLDER = base64.b64encode(VALUE_PLACEHOLDER.encode())
+VALUE_PLACEHOLDER_TEMPLATE = "..PLACEHOLDER_{name}.."
 HELM_REPOSITORY = "HelmRepository"
 GIT_REPOSITORY = "GitRepository"
 OCI_REPOSITORY = "OCIRepository"
@@ -430,10 +429,12 @@
         # placeholder values anyway.
         if data := doc.get("data"):
             for key, value in data.items():
-                data[key] = VALUE_B64_PLACEHOLDER
+                data[key] = base64.b64encode(
+                    VALUE_PLACEHOLDER_TEMPLATE.format(name=key).encode()
+                )
         if string_data := doc.get("stringData"):
             for key, value in string_data.items():
-                string_data[key] = VALUE_PLACEHOLDER
+                string_data[key] = VALUE_PLACEHOLDER_TEMPLATE.format(name=key)
         return Secret(
             name=name, namespace=namespace, data=data, string_data=string_data
         )
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/flux_local-6.0.0/flux_local/tool/visitor.py 
new/flux_local-6.0.2/flux_local/tool/visitor.py
--- old/flux_local-6.0.0/flux_local/tool/visitor.py     2024-10-08 
16:32:16.000000000 +0200
+++ new/flux_local-6.0.2/flux_local/tool/visitor.py     2024-11-10 
19:31:14.000000000 +0100
@@ -177,6 +177,23 @@
                         helm_release.images.sort()
 
 
+def strip_resource_attributes(resource: dict[str, Any], strip_attributes: 
list[str]) -> None:
+    """Strip any annotations from kustomize that contribute to diff noise when 
objects are re-ordered in the output."""
+    strip_attrs(resource["metadata"], strip_attributes)
+    # Remove common noisy labels in commonly used templates
+    if (
+        (spec := resource.get("spec"))
+        and (templ := spec.get("template"))
+        and (meta := templ.get("metadata"))
+    ):
+        strip_attrs(meta, strip_attributes)
+    if resource["kind"] == "List" and (items := resource.get("items")) and 
isinstance(items, list):
+        for item in items:
+            if not (item_meta := item.get("metadata")):
+                continue
+            strip_attrs(item_meta, strip_attributes)
+
+
 class ObjectOutput(ResourceOutput):
     """Resource visitor that builds outputs for objects within the 
kustomization."""
 
@@ -208,14 +225,8 @@
                     )
                     continue
                 # Remove common noisy labels
-                strip_attrs(metadata, self.strip_attributes)
-                # Remove common noisy labels in commonly used templates
-                if (
-                    (spec := resource.get("spec"))
-                    and (templ := spec.get("template"))
-                    and (meta := templ.get("metadata"))
-                ):
-                    strip_attrs(meta, self.strip_attributes)
+                strip_resource_attributes(resource, self.strip_attributes)
+
                 resource_key = ResourceKey(
                     kind=kind,
                     kustomization_path=str(kustomization_path),
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/flux_local-6.0.0/flux_local/values.py 
new/flux_local-6.0.2/flux_local/values.py
--- old/flux_local-6.0.0/flux_local/values.py   2024-10-08 16:32:16.000000000 
+0200
+++ new/flux_local-6.0.2/flux_local/values.py   2024-11-10 19:31:14.000000000 
+0100
@@ -14,7 +14,7 @@
     CONFIG_MAP_KIND,
     ConfigMap,
     Secret,
-    VALUE_PLACEHOLDER,
+    VALUE_PLACEHOLDER_TEMPLATE,
     ValuesReference,
 )
 from .exceptions import HelmException, InputException, InvalidValuesReference
@@ -163,7 +163,7 @@
             # When a target path is specified, the value is expected to be
             # a simple value type. Create a synthetic placeholder value, 
otherwise
             # there is nothing to replace.
-            return VALUE_PLACEHOLDER
+            return VALUE_PLACEHOLDER_TEMPLATE.format(name=ref.name)
         return None
 
     elif (found_value := found_data.get(ref.values_key)) is None:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/flux_local-6.0.0/flux_local.egg-info/PKG-INFO 
new/flux_local-6.0.2/flux_local.egg-info/PKG-INFO
--- old/flux_local-6.0.0/flux_local.egg-info/PKG-INFO   2024-10-08 
16:32:21.000000000 +0200
+++ new/flux_local-6.0.2/flux_local.egg-info/PKG-INFO   2024-11-10 
19:31:17.000000000 +0100
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: flux-local
-Version: 6.0.0
+Version: 6.0.2
 Summary: flux-local is a python library and set of tools for managing a flux 
gitops repository, with validation steps to help improve quality of commits, 
PRs, and general local testing.
 Home-page: https://github.com/allenporter/flux-local
 Author: Allen Porter
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/flux_local-6.0.0/flux_local.egg-info/SOURCES.txt 
new/flux_local-6.0.2/flux_local.egg-info/SOURCES.txt
--- old/flux_local-6.0.0/flux_local.egg-info/SOURCES.txt        2024-10-08 
16:32:21.000000000 +0200
+++ new/flux_local-6.0.2/flux_local.egg-info/SOURCES.txt        2024-11-10 
19:31:17.000000000 +0100
@@ -46,4 +46,5 @@
 tests/tool/test_get_cluster.py
 tests/tool/test_get_hr.py
 tests/tool/test_get_ks.py
-tests/tool/test_test.py
\ No newline at end of file
+tests/tool/test_test.py
+tests/tool/test_visitor.py
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/flux_local-6.0.0/setup.cfg 
new/flux_local-6.0.2/setup.cfg
--- old/flux_local-6.0.0/setup.cfg      2024-10-08 16:32:21.947679800 +0200
+++ new/flux_local-6.0.2/setup.cfg      2024-11-10 19:31:17.995438000 +0100
@@ -1,6 +1,6 @@
 [metadata]
 name = flux-local
-version = 6.0.0
+version = 6.0.2
 description = flux-local is a python library and set of tools for managing a 
flux gitops repository, with validation steps to help improve quality of 
commits, PRs, and general local testing.
 long_description = file: README.md
 long_description_content_type = text/markdown
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/flux_local-6.0.0/tests/test_values.py 
new/flux_local-6.0.2/tests/test_values.py
--- old/flux_local-6.0.0/tests/test_values.py   2024-10-08 16:32:16.000000000 
+0200
+++ new/flux_local-6.0.2/tests/test_values.py   2024-11-10 19:31:14.000000000 
+0100
@@ -172,7 +172,7 @@
     assert updated_hr.values == {
         "test": "test",
         "target": {
-            "path": "..PLACEHOLDER..",
+            "path": "..PLACEHOLDER_test-values-secret..",
         },
     }
 
@@ -437,8 +437,8 @@
     assert updated_hr.values == {
         "test": "test",
         "target": {
-            "path1": "..PLACEHOLDER..",
-            "path2": "..PLACEHOLDER..",
+            "path1": "..PLACEHOLDER_some-key1..",
+            "path2": "..PLACEHOLDER_some-key2..",
         },
     }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/flux_local-6.0.0/tests/tool/test_visitor.py 
new/flux_local-6.0.2/tests/tool/test_visitor.py
--- old/flux_local-6.0.0/tests/tool/test_visitor.py     1970-01-01 
01:00:00.000000000 +0100
+++ new/flux_local-6.0.2/tests/tool/test_visitor.py     2024-11-10 
19:31:14.000000000 +0100
@@ -0,0 +1,250 @@
+"""Tests for the visitor module."""
+
+from typing import Any
+import yaml
+
+import pytest
+
+
+from flux_local.tool.visitor import strip_resource_attributes
+
+STRIP_ATTRIBUTES = [
+    "app.kubernetes.io/version",
+    "chart",
+]
+
+
+@pytest.mark.parametrize(
+    ("metadata", "expected_metadata"),
+    [
+        (
+            {
+                "labels": {
+                    "app.kubernetes.io/version": "1.0.0",
+                    "app.kubernetes.io/managed-by": "Helm",
+                }
+            },
+            {
+                "labels": {
+                    "app.kubernetes.io/managed-by": "Helm",
+                },
+            },
+        ),
+        (
+            {
+                "annotations": {
+                    "app.kubernetes.io/version": "1.0.0",
+                    "app.kubernetes.io/managed-by": "Helm",
+                }
+            },
+            {
+                "annotations": {
+                    "app.kubernetes.io/managed-by": "Helm",
+                },
+            },
+        ),
+        (
+            {},
+            {},
+        ),
+    ],
+)
+def test_strip_resource_attributes(
+    metadata: dict[str, Any], expected_metadata: dict[str, Any]
+) -> None:
+    """Test the strip_resource_attributes function."""
+    resource = {
+        "apiVersion": "v1",
+        "kind": "ConfigMap",
+        "metadata": {
+            "name": "my-configmap",
+            "namespace": "default",
+            **metadata,
+        },
+        "data": {
+            "key1": "value1",
+            "key2": "value2",
+        },
+    }
+    strip_resource_attributes(resource, STRIP_ATTRIBUTES)
+    assert resource == {
+        "apiVersion": "v1",
+        "kind": "ConfigMap",
+        "metadata": {
+            "name": "my-configmap",
+            "namespace": "default",
+            **expected_metadata,
+        },
+        "data": {
+            "key1": "value1",
+            "key2": "value2",
+        },
+    }
+
+
+def test_strip_deployment_metadata() -> None:
+    """Test the strip_resource_attributes function."""
+    resource = yaml.load(
+        """apiVersion: apps/v1
+kind: Deployment
+metadata:
+  name: nginx-deployment
+  labels:
+    app: nginx
+spec:
+  replicas: 3
+  selector:
+    matchLabels:
+      app: nginx
+  template:
+    metadata:
+      labels:
+        app: nginx
+        app.kubernetes.io/version: 1.0.0
+    spec:
+      containers:
+      - name: nginx
+        image: nginx:1.14.2
+        ports:
+        - containerPort: 80
+""",
+        Loader=yaml.Loader,
+    )
+
+    strip_resource_attributes(resource, STRIP_ATTRIBUTES)
+    assert (
+        yaml.dump(resource, sort_keys=False)
+        == """apiVersion: apps/v1
+kind: Deployment
+metadata:
+  name: nginx-deployment
+  labels:
+    app: nginx
+spec:
+  replicas: 3
+  selector:
+    matchLabels:
+      app: nginx
+  template:
+    metadata:
+      labels:
+        app: nginx
+    spec:
+      containers:
+      - name: nginx
+        image: nginx:1.14.2
+        ports:
+        - containerPort: 80
+"""
+    )
+
+
+def test_strip_list_metadata() -> None:
+    """Test the stripping metadata from a list resource."""
+    resource = yaml.load(
+        """apiVersion: v1
+items:
+- apiVersion: stable.example.com/v1
+  kind: CronTab
+  metadata:
+    annotations:
+      app: my-cron-tab
+      app.kubernetes.io/version: 1.0.0
+    creationTimestamp: '2021-06-20T07:35:27Z'
+    generation: 1
+    name: my-new-cron-object
+    namespace: default
+    resourceVersion: '1326'
+    uid: 9aab1d66-628e-41bb-a422-57b8b3b1f5a9
+  spec:
+    cronSpec: '* * * * */5'
+    image: my-awesome-cron-image
+kind: List
+metadata:
+  resourceVersion: ''
+  selfLink: ''
+
+""",
+        Loader=yaml.Loader,
+    )
+
+    strip_resource_attributes(resource, STRIP_ATTRIBUTES)
+    assert (
+        yaml.dump(resource, sort_keys=False)
+        == """apiVersion: v1
+items:
+- apiVersion: stable.example.com/v1
+  kind: CronTab
+  metadata:
+    annotations:
+      app: my-cron-tab
+    creationTimestamp: '2021-06-20T07:35:27Z'
+    generation: 1
+    name: my-new-cron-object
+    namespace: default
+    resourceVersion: '1326'
+    uid: 9aab1d66-628e-41bb-a422-57b8b3b1f5a9
+  spec:
+    cronSpec: '* * * * */5'
+    image: my-awesome-cron-image
+kind: List
+metadata:
+  resourceVersion: ''
+  selfLink: ''
+"""
+    )
+
+
+def test_strip_list_null_items() -> None:
+    """Test corner cases of handling metadata."""
+    resource = yaml.load(
+        """apiVersion: v1
+kind: List
+metadata:
+  resourceVersion: ''
+  selfLink: ''
+items:
+
+""",
+        Loader=yaml.Loader,
+    )
+
+    strip_resource_attributes(resource, STRIP_ATTRIBUTES)
+    assert (
+        yaml.dump(resource, sort_keys=False)
+        == """apiVersion: v1
+kind: List
+metadata:
+  resourceVersion: ''
+  selfLink: ''
+items: null
+"""
+    )
+
+
+def test_strip_list_item_without_metdata() -> None:
+    """Test corner cases of handling metadata."""
+    resource = yaml.load(
+        """apiVersion: v1
+kind: List
+metadata:
+  resourceVersion: ''
+  selfLink: ''
+items:
+- kind: CronTab
+""",
+        Loader=yaml.Loader,
+    )
+
+    strip_resource_attributes(resource, STRIP_ATTRIBUTES)
+    assert (
+        yaml.dump(resource, sort_keys=False)
+        == """apiVersion: v1
+kind: List
+metadata:
+  resourceVersion: ''
+  selfLink: ''
+items:
+- kind: CronTab
+"""
+    )

Reply via email to