Skip to content

Expose OCI origin revision in events - #2127

Open
ruslan-shaydullin wants to merge 1 commit into
fluxcd:mainfrom
ruslan-shaydullin:feat/oci-origin-revision-events
Open

Expose OCI origin revision in events#2127
ruslan-shaydullin wants to merge 1 commit into
fluxcd:mainfrom
ruslan-shaydullin:feat/oci-origin-revision-events

Conversation

@ruslan-shaydullin

Copy link
Copy Markdown

OCI artifacts can record their source revision in the
org.opencontainers.image.revision annotation. This forwards that value as
source.toolkit.fluxcd.io/originRevision on successful OCIRepository events,
allowing notification consumers to correlate an artifact with its source
commit.

The existing artifact revision and event message remain unchanged. The extra
event metadata is omitted when the annotation is empty or absent.

Closes fluxcd/notification-controller#1284

Testing

  • go test ./internal/controller -run '^TestOCIRepositoryReconciler_notify$' -count=1
  • go test -race ./internal/controller -run '^TestOCIRepositoryReconciler_notify$' -count=1
  • go vet ./...
  • cd api && go vet ./...
  • git diff --check

OCI artifacts can record their source revision in the
org.opencontainers.image.revision annotation. Include that value in
successful events so notification consumers can correlate an artifact
with its source commit.

Keep the existing artifact revision unchanged and omit the extra event
metadata when the annotation is empty.

Signed-off-by: Ruslan Shaydullin <shaydullin.r.d@outlook.com>
@stefanprodan

Copy link
Copy Markdown
Member

How does this affect kustomize-controller and helm-controller since they inject the originRevision on their own. Will it end up as a duplicate?

@matheuscscp

Copy link
Copy Markdown
Member

How does this affect kustomize-controller and helm-controller since they inject the originRevision on their own. Will it end up as a duplicate?

The controllers emit independent events. source-controller will have its own messages, reasons, object kind, etc. I'd not call this a duplicate. The Alert API allows filtering which events you want to propagate to the Provider, so this LGTM.

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

Successfully merging this pull request may close these issues.

generic provider payloads lack structured commit/revision metadata for OCIRepository event sources

3 participants