Skip to content

feat!: merge subject.source into subject.id#302

Open
davidB wants to merge 1 commit intocdevents:mainfrom
davidB:feat_merge_subject_source
Open

feat!: merge subject.source into subject.id#302
davidB wants to merge 1 commit intocdevents:mainfrom
davidB:feat_merge_subject_source

Conversation

@davidB
Copy link
Copy Markdown
Contributor

@davidB davidB commented Mar 23, 2026

Changes

Merge subject.source into subject.id:

  • subject.id definition change (becomes an URI-reference, an global)
  • remove subject.source and content.{service,repository,pipelineRun,environment}.source

see: #252 for initial proposal / discussion

Submitter Checklist

As the author of this PR, please check off the items in this checklist:

Signed-off-by: David Bernard <david.bernard.31@gmail.com>
@davidB davidB force-pushed the feat_merge_subject_source branch from 626937c to cd24bde Compare March 23, 2026 17:49
@davidB davidB marked this pull request as ready for review March 23, 2026 17:54
@davidB davidB requested a review from a team as a code owner March 23, 2026 17:54
Copy link
Copy Markdown
Member

@afrittoli afrittoli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! We'll need to document this change carefully in the release notes

@xibz
Copy link
Copy Markdown
Contributor

xibz commented Apr 21, 2026

During the SIG April 21st, 2026, we (@dsanyika and I) should probably keep subject.source as separate, but make it a required field instead. That may solve your issue @davidB, thoughts?

@davidB
Copy link
Copy Markdown
Contributor Author

davidB commented Apr 22, 2026

That solves part of the issue.
The advantage of the merging:

  • Only one field to look for when linking/referencing (easier also when creating Database, graph, rules, ...)
  • No question for the case where id is already an absolute URI, like for artifacts
  • No additional questions/rules about how to split between id and source for a global id/reference.

Some example (you can try to split between the source and id):

  • a repository: ${.body.repository.url} (on GitHub event), else we have to reconstruct it with like https://${host}(:${port}?/${owner}/${repo} (iirc on GitLab ${owner} can be a path of several levels). (remimder, github, gitlab, ... can run on-premises)
  • a pipelinerun id for github: ${.body.workflow_run.url}/attempts/${.body.workflow_run.run_attempt} (https://api.github.com/repos/cdviz-dev/cdviz-collector/actions/runs/24767867847/attempts/1)
  • a pipelinerun id for gitlab: ${project_web_url}/-/pipelines/${pipeline.id} (no concept of rerun/attempt at pipeline level in gitlab iirc, but present for taskrun).
  • a github issue: https://github.com/cdevents/spec/issues/305
  • a jira issue: https://example.atlassian.net/browse/PROJ-1
  • a change id (for github): ${.body.pull_request.url} (eg https://github.com/cdevents/spec/pull/302)
  • a service id:
    • ${namespace}/${resource_name}/${container_name} (when packageId is a container image running on a kubernetes cluster)
    • ${namespace}/${resource_name} (when the packageId is a resource like helm chart, argo application, ...)

IMHO, it's not the purpose of CDEvents to define the rules (how to split or extract information) for each provider; we already have to work on removing questions/ambiguity and share real example.
I'll watch the meeting records when I'll be back.

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.

3 participants