-
Notifications
You must be signed in to change notification settings - Fork 16
docs(conventions): define artefact-linking label convention #146
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
Open
bedirhan-yilmaz
wants to merge
4
commits into
open-component-model:main
Choose a base branch
from
bedirhan-yilmaz:feat/artefact-linking-label-convention
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+134
−25
Open
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
a40dce5
docs: define artefact-linking label convention for cross-artefact rel…
bedirhan-yilmaz a3a7f2e
docs: refine artefact-linking label convention
bedirhan-yilmaz ef044c9
docs: update artefact-linking label convention and clarify label valu…
bedirhan-yilmaz 3555c19
docs: clarify label naming conventions and update examples in extensions
bedirhan-yilmaz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -29,3 +29,131 @@ | |
| Usage scenarios for sets of described artifacts are best described by a dedicated description artifact with a dedicated tool-specific artifact type. Here, there is the complete freedom to describe the conditions and environments artifacts are to be used. The artifacts are described by [relative resource references](../05-guidelines/03-references.md#relative-artifact-references) in relation to the component version containing the description artifact. | ||
|
|
||
| Another possibility is to use dedicated [labels](./03-elements-sub.md#labels) to describe the usage scenario for dedicated artifacts. Here, the tool working on a component versions does not read a description artifact, but has to analyse the label settings of all the provided artifacts. In both cases there is a dedicated OCM specific interpretation of content provided by the component model. But while the first solution allows to describe a closed scenario in a dedicated resource, where resources from dependent component version can be described by relative resource references and multiple scenarios can be separated by multiple flavors of this resource, the label-based approach is restricted to a local component version and a single scenario. Instead of an artifact type for the description, labels with a defined [name structure](./03-elements-sub.md#labels) are required. | ||
|
|
||
| ## Artefact-Linking Label | ||
|
|
||
| This section defines a label convention for expressing cross-artefact relationships. | ||
| For example, it can be used to indicate that an SBoM resource describes a specific | ||
| OCI image resource within the same component version. | ||
|
|
||
| ### Label Name | ||
|
|
||
| ``` | ||
|
Check failure on line 41 in doc/01-model/06-conventions.md
|
||
| odg.ocm.software/labels/artefact-ref/v1 | ||
| ``` | ||
|
|
||
| The label follows the [vendor-specific label naming scheme](./07-extensions.md#label-types). | ||
| The version suffix (`v1`) is encoded in the label name; consumers MUST NOT treat a | ||
| label with a different version suffix as conforming to this convention. | ||
|
|
||
| ### Placement | ||
|
|
||
| The label is placed on the **derived artefact**. The resource that is related to a | ||
| subject artefact carries the label pointing back to that subject. The subject | ||
| artefact itself requires no modification. | ||
|
|
||
| ``` | ||
|
Check failure on line 55 in doc/01-model/06-conventions.md
|
||
| Component Descriptor | ||
| ├── Resource: my-image ← subject artefact, unchanged | ||
| └── Resource: my-image-sbom ← derived artefact, carries the label | ||
| ``` | ||
|
|
||
| ### Label Value | ||
|
|
||
| The label value is a YAML object with the following fields: | ||
|
|
||
| **`artefactReference`** (required) - identifies the subject artefact within the same | ||
|
bedirhan-yilmaz marked this conversation as resolved.
Outdated
|
||
| component version: | ||
|
|
||
| - `name` (required) *string* — resource name of the subject artefact. | ||
| - `version` (optional) *string* — resource version. If omitted, any version matches. | ||
| - `extraIdentity` (optional) *map[string]string* — extra identity key-value pairs. | ||
| Every entry listed here MUST be present and equal in the subject's `extraIdentity`. | ||
| Required when multiple resources share the same name (e.g. arch-specific image variants). | ||
|
|
||
| **`metadata`** (optional) — additional context about the relationship: | ||
|
|
||
| - `relation` (optional) *string* — token describing the nature of the relationship. | ||
| Recommended values: | ||
| - `describes` — the derived artefact describes the subject (e.g. an SBoM). | ||
| - `attests` — the derived artefact attests a property of the subject. | ||
|
|
||
| Additional values MAY be defined by tooling. Consumers that do not recognise a | ||
| value SHOULD treat the label as a generic artefact reference. | ||
|
|
||
| ### Examples | ||
|
|
||
| An SBoM describing a single-variant image: | ||
|
|
||
| ```yaml | ||
| resources: | ||
| - name: my-image | ||
| version: 1.2.3 | ||
| type: ociImage | ||
|
|
||
| - name: my-image-sbom | ||
| version: 1.2.3 | ||
| type: application/spdx+json | ||
|
bedirhan-yilmaz marked this conversation as resolved.
Outdated
|
||
| labels: | ||
| - name: odg.ocm.software/labels/artefact-ref/v1 | ||
|
bedirhan-yilmaz marked this conversation as resolved.
Outdated
|
||
| value: | ||
| artefactReference: | ||
| name: my-image | ||
| metadata: | ||
| relation: describes | ||
|
8R0WNI3 marked this conversation as resolved.
Outdated
|
||
| ``` | ||
|
|
||
| Two derived artefacts referencing a specific architecture variant via `extraIdentity`: | ||
|
|
||
| ```yaml | ||
| resources: | ||
| - name: my-image | ||
| version: 1.2.3 | ||
| type: ociImage | ||
| extraIdentity: | ||
| arch: amd64 | ||
|
|
||
| - name: my-image-sbom | ||
| version: 1.2.3 | ||
| type: application/spdx+json | ||
|
8R0WNI3 marked this conversation as resolved.
Outdated
|
||
| labels: | ||
| - name: odg.ocm.software/labels/artefact-ref/v1 | ||
| value: | ||
| artefactReference: | ||
| name: my-image | ||
| version: 1.2.3 | ||
| extraIdentity: | ||
| arch: amd64 | ||
| metadata: | ||
| relation: describes | ||
|
|
||
| - name: my-image-attestation | ||
| version: 1.2.3 | ||
| type: application/vnd.in-toto+json | ||
| labels: | ||
|
bedirhan-yilmaz marked this conversation as resolved.
|
||
| - name: odg.ocm.software/labels/artefact-ref/v1 | ||
| value: | ||
| artefactReference: | ||
| name: my-image | ||
| version: 1.2.3 | ||
| extraIdentity: | ||
| arch: amd64 | ||
| metadata: | ||
| relation: attests | ||
| ``` | ||
|
|
||
| ### Lookup Algorithm | ||
|
|
||
| To find all artefacts related to a given subject resource: | ||
|
|
||
| 1. Determine the identity of the subject resource: its `name`, `version`, and `extraIdentity`. | ||
| 2. Iterate over all resources in the component descriptor. | ||
| 3. For each resource, check whether it carries a label named `odg.ocm.software/labels/artefact-ref/v1`. | ||
| 4. If present, apply the following matching rules against `artefactReference`: | ||
| - `name` MUST equal the subject's `name`. | ||
| - If `version` is set, it MUST equal the subject's `version`. | ||
| - If `extraIdentity` is set, every key-value pair it contains MUST be present | ||
| and equal in the subject's `extraIdentity`. | ||
| 5. Optionally filter the collected resources by `metadata.relation`. | ||
|
|
||
| Resources that pass all checks are companions of the subject. | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.