fluxcd / notification-controller

The GitOps Toolkit event forwarder and notification dispatcher
https://fluxcd.io
Apache License 2.0
152 stars 132 forks source link

OCIRepository type should be allowed in Receiver spec #400

Closed kingdonb closed 2 years ago

kingdonb commented 2 years ago

I see that OCIRepository type is an allowed event source in 0.25.0

OCIRepository should also be added as an allowed target for receiver, but it looks like it has not yet. (Will this be possible to include before the final release?)

I tried it just now with the latest commit from the oci branch, that appears to include this latest notification controller release, and just to confirm it does look like that needs to be added:

flux-system        flux-system        6d18h   False     Receiver/podinfo-flux-oci/podinfo-package dry-run failed, reason: Invalid, error: Receiver.notification.toolkit.fluxcd.io "podinfo-package" is invalid: spec.resources.kind: Unsupported value: "OciRepository": supported values: "Bucket", "GitRepository", "Kustomization", "HelmRelease", "HelmChart", "HelmRepository", "ImageRepository", "ImagePolicy", "ImageUpdateAutomation"...

This is my Receiver:

apiVersion: notification.toolkit.fluxcd.io/v1beta1
kind: Receiver
metadata:
  name: podinfo-package
  namespace: podinfo-flux-oci
spec:
  events:
  - package
  - ping
  resources:
  - kind: OciRepository
    name: podinfo
    namespace: podinfo-flux-oci
  secretRef:
    name: webhook-token
  type: github

I am uncertain whether package webhooks work with any other target, I will test that next. From a quick search of the open issues, signs point to no:

darkowlzz commented 2 years ago

The issue seems to due to the kind value being OciRepository instead of OCIRepository. The full error message contains OCIRepository as a supported kind:

The Receiver "podinfo-package" is invalid: spec.resources[0].kind: Unsupported value: "OciRepository": supported values: "Bucket", "GitRepository", "Kustomization", "HelmRelease", "HelmChart", "HelmRepository",
"ImageRepository", "ImagePolicy", "ImageUpdateAutomation", "OCIRepository"
kingdonb commented 2 years ago

Oh, good catch @darkowlzz – then I'll fix it in my test manifest and close this, (but #393 still blocks this feature from working together properly with GitHub GHCR.)