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

Support Git commit status updates for OCIRepository #5148

Closed
matheuscscp opened this issue Jan 15, 2025 · 2 comments · Fixed by fluxcd/website#2129
Closed

Support Git commit status updates for OCIRepository #5148

matheuscscp opened this issue Jan 15, 2025 · 2 comments · Fixed by fluxcd/website#2129
Assignees
Labels
area/notification Notification API related issues and pull requests area/oci OCI related issues and pull requests enhancement New feature or request

Comments

@matheuscscp
Copy link
Member

matheuscscp commented Jan 15, 2025

Discussed in #5140

Originally posted by xunholy January 9, 2025
Currently it's common practice to include alerts on kustomizations to publish the status back to the origin commit status.

EG.

apiVersion: notification.toolkit.fluxcd.io/v1beta3
kind: Alert
metadata:
  name: github-kustomization-alerts
  namespace: flux-system
spec:
  providerRef:
    name: github
  eventSeverity: info
  eventSources:
    - kind: Kustomization
      name: '*'

However, when these kustomizations are using the OCIRepository sourceRef the notification-conroller is unable to match the commit SHA in order to place the commit status.

Error

3ceff2f-46de-4b04-be31-6a03e9c3e943","apiVersion":"kustomize.toolkit.fluxcd.io/v1","resourceVersion":"166196199"},"Alert":{"name":"github-kustomization-alerts","namespace":"flux-system"},"error":"failed to extract commit hash from 'main@sha256:6f132a51cacdd080a2efc97cdc20b1807c025b6464c58a530f3803373d5f12cf' revision"}

One possible solution is to allow the kustomize-controller to forward the OCI annotation called org.opencontainers.image.revision to notification-controller so it can extract the revision from the metadata.

This would allow for a better user experience and feedback loops when using the OCIRepository type, especially in mono repositories where there is a high amount of change.

@matheuscscp matheuscscp added enhancement New feature or request area/notification Notification API related issues and pull requests area/oci OCI related issues and pull requests labels Jan 15, 2025
@matheuscscp matheuscscp self-assigned this Jan 15, 2025
@stefanprodan stefanprodan changed the title Support git commit status notifications for OCIRepository Support Git commit status updates for OCIRepository Jan 15, 2025
@stefanprodan
Copy link
Member

stefanprodan commented Jan 15, 2025

To implement this, the kustomize-controller should add a metadata entry to the events emitted from reconciling an OCIRepository source with the following format:

 kustomize.toolkit.fluxcd.io/originRevision: <value of org.opencontainers.image.revision>

When receiving events, notification-controller should use originRevision instead of revision to determine the commit SHA for status update. Furthermore, the originRevision should show up in Slack/MSTeams/etc in the alert body.

@stefanprodan
Copy link
Member

We need to add a task for updating the docs or for creating some new guide to tell people about this feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/notification Notification API related issues and pull requests area/oci OCI related issues and pull requests enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants