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

Regression in available data in commit message templating #771

Open
tun0 opened this issue Oct 17, 2024 · 1 comment
Open

Regression in available data in commit message templating #771

tun0 opened this issue Oct 17, 2024 · 1 comment

Comments

@tun0
Copy link

tun0 commented Oct 17, 2024

Given the following template (we basically dump all available information in a machine-parsable format):

      messageTemplate: |
        Image Update Automation:{{ range $images := .Updated.Images }} {{ $images }}{{ end }}

        ---
        automation: {{ .AutomationObject }}
        files:
        {{- range $file, $fileresult := .Updated.Files }}
        -
          filename: {{ $file }}
          objects:
        {{- range $object, $imagerefs := $fileresult.Objects }}
          -
            apiVersion: {{ $object.APIVersion }}
            kind: {{ $object.Kind }}
            name: {{ $object.Name }}
            namespace: {{ $object.Namespace }}
            images:
        {{- range $imageref := $imagerefs }}
            -
              shortName: {{ $imageref }}
              fullName: {{ $imageref.Name }}
              registry: {{ $imageref.Registry }}
              repository: {{ $imageref.Repository }}
              identifier: {{ $imageref.Identifier }}
              policy: {{ $imageref.Policy }}
        {{- end -}}
        {{- end -}}
        {{- end }}
        fileChanges:
        {{- range $file, $objectChanges := .Changed.FileChanges }}
        -
          filename: {{ $file }}
          changes:
        {{- range $object, $changes := $objectChanges }}
          -
            apiVersion: {{ $object.APIVersion }}
            kind: {{ $object.Kind }}
            name: {{ $object.Name }}
            namespace: {{ $object.Namespace }}
            changes:
        {{- range $change := $changes }}
            -
              oldValue: {{ $change.OldValue }}
              newValue: {{ $change.NewValue }}
              setter: {{ $change.Setter }}
        {{- end }}
        {{- end }}
        {{- end }}
        ...

It yields the following commit message:

---
automation: flux-system/cluster
files:
-
  filename: flux-system/kustomization.yaml
  objects:
  -
    apiVersion: kustomize.config.k8s.io/v1beta1
    kind: Kustomization
    name: 
    namespace: 
    images:
    -
      shortName: europe-west4-docker.pkg.dev/treehouse-devops/team--devops--containers/flux-event-handler:v2-8109fd4-20241017114458
      fullName: europe-west4-docker.pkg.dev/treehouse-devops/team--devops--containers/flux-event-handler:v2-8109fd4-20241017114458
      registry: europe-west4-docker.pkg.dev
      repository: treehouse-devops/team--devops--containers/flux-event-handler
      identifier: v2-8109fd4-20241017114458
      policy: flux-system/devops-flux-event-handler-v2
fileChanges:
-
  filename: flux-system/kustomization.yaml
  changes:
  -
    apiVersion: kustomize.config.k8s.io/v1beta1
    kind: Kustomization
    name: 
    namespace: 
    changes:
    -
      oldValue: v2-8109fd4-20241017114306
      newValue: v2-8109fd4-20241017114458
      setter: flux-system:devops-flux-event-handler-v2:tag
...

In the new .Changed based data we no longer know which image it is about. The .Updated based data does have that information.

Also, is it expected that there's no additional information on the Kustomization itself?

@tun0
Copy link
Author

tun0 commented Oct 17, 2024

For non-kustomized changes, the message does contain the full image name+tag. As well as the additional info for the resource(s) affected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant