Skip to content

Commit 3d5fada

Browse files
committed
adapt ADR
1 parent 269f248 commit 3d5fada

File tree

4 files changed

+64
-38
lines changed

4 files changed

+64
-38
lines changed

.github/config/markdownlint.yml

+3
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,8 @@ default: true
22

33
MD013: false #Line length - https://github.com/DavidAnson/markdownlint/blob/HEAD/doc/Rules.md#md013
44
MD033: false #Inline HTML - https://github.com/DavidAnson/markdownlint/blob/HEAD/doc/Rules.md#md033
5+
MD001: false #Inline HTML - https://github.com/DavidAnson/markdownlint/blob/HEAD/doc/Rules.md#md001
6+
MD004:
7+
style: consistent
58
MD024:
69
siblings_only: true #Multiple headers with the same content

.github/config/wordlist.txt

+5-1
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,9 @@ typename
286286
unmarshaller
287287
unmodifiable
288288
untrusted
289+
untyped
289290
updatevendorhash
291+
uploadable
290292
uploader
291293
uploaderdescriptor
292294
uploaders
@@ -308,4 +310,6 @@ xml
308310
yaml
309311
yitsushi
310312
yml
311-
yyyy
313+
yyyy
314+
fabianburth
315+
jakobmoellerdev

cmds/ocm/commands/ocmcmds/sources/add/cmd_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import (
88

99
. "github.com/onsi/ginkgo/v2"
1010
. "github.com/onsi/gomega"
11-
"ocm.software/ocm/api/utils/runtime"
1211
. "ocm.software/ocm/cmds/ocm/testhelper"
1312

1413
"ocm.software/ocm/api/ocm/compdesc"
@@ -18,6 +17,7 @@ import (
1817
"ocm.software/ocm/api/utils/blobaccess"
1918
"ocm.software/ocm/api/utils/mime"
2019
common "ocm.software/ocm/api/utils/misc"
20+
"ocm.software/ocm/api/utils/runtime"
2121
)
2222

2323
const (

docs/adrs/0003-referene-hints.md renamed to docs/adrs/0003-reference-hints.md

+55-36
Original file line numberDiff line numberDiff line change
@@ -1,83 +1,108 @@
1-
# Architectural Decision Record: Rework of Referebce Hints
1+
# ADR-0003 - Rework of Reference Hints
2+
3+
- Status: proposed
4+
- Date: 2024-12-27
5+
- Authors: @mandelsoft
6+
- Deciders: @fabianburth @jakobmoellerdev
7+
- Reference Implementation: #1212
28

39
### Meaning of Reference Hints
410

511
During the transport of software artifacts referenced from external artifact repositories like
612
OCI registries, they might be stored as blobs along with the component version (access method
7-
`localBlob`. If those component versions are transported again into a repository landscape they
13+
`localBlob`). If those component versions are transported again into a repository landscape they
814
might be uploaded again to external repositories.
915

1016
To provide useful identities for storing those artifacts hints in external repositories, again,
1117
the original identity of the external artifact must be stored along with the local blob.
1218

1319
### Current Solution
1420

15-
The access method origibally used to refernce the exterbal artfact provides a reference hint,
21+
The access method originally used to reference the external artifact provides a reference hint,
1622
which can later be used by the blob uploaders to reconstruct a useful identity.
1723
Therefore, the `localBlob` access method is able to keep track of this hint value.
18-
The hint is just a string, which needs to be intepreted by the uploader.
24+
The hint is just a string, which needs to be interpreted by the uploader.
1925

2026
### Problems with Current Solution
2127

22-
The assumprion behind the current solution is that the uploader will always upload the
23-
artifactinto a similar repository, again. Therefore, there would be a one-to-one relation
28+
The assumption behind the current solution is that the uploader will always upload the
29+
artifact into a similar repository, again. Therefore, there would be a one-to-one relation
2430
between access method and uploader.
2531

2632
Unfortunately this is not true in all cases:
33+
2734
- There are access methods now (like`wget`), which are able to handle any kind of artifact blob
28-
with different natural repositoty types and identity schemes.
29-
- Therefore,
35+
with different natural repository types and identity schemes.
36+
- Therefore,
3037
- it can neither provide an implicit reference hint anymore
3138
- nor there is a one-to-one relation to a typed uploader anymore.
3239
- artifacts might be uploadable to different repository types using different
3340
identity schemes.
3441

3542
This problem is partly covered by allowing to specify a hint along with those access methods
36-
similar to the `localBlob` access method. But this can only be a workarround, because
37-
- the hint is not typed and potential target repositories might use diufferent identity schemes
43+
similar to the `localBlob` access method. But this can only be a workaround, because
44+
45+
- the hint is not typed and potential target repositories might use different identity schemes
3846
- it is possible to store a single hint, only.
3947

4048
### Proposed Solution
4149

42-
Hints have to be typed, to allow uploaders to know what identites are provided and how the
50+
Hints have to be typed, to allow uploaders to know what identities are provided and how the
4351
hint string has to be interpreted. Additionally, it must be possible to store
44-
mulltiple hints for an artifact.
52+
multiple hints for an artifact.
4553

4654
To be compatible a serialization format is defined for a list of type hints, which maps such
4755
a list to a single string.
4856

49-
The library provides a new type `ReferenceHint = map[string]string`, which provides access to
57+
The library provides a new type `ReferenceHint = map[string]string`, which provides access to
5058
a formal hint, by providing access to a set of string attributes. There are three predefined
5159
attributes:
60+
5261
- `type` the formal type of the hint (may be empty to cover old component versions)
5362
The types are defined like the resource types. The following types are defined for now:
54-
- `oci`: OCI identity given by the attribute `reference` with the cirrently used format
63+
- `oci`: OCI identity given by the attribute `reference` with the currently used format
5564
- `maven`: Maven identity (GAV) given by the attribute `reference` with the currently used format
5665
- `npm`: Node package identity given by the attribute `reference` with the currently used
5766
format
5867
- `reference`: the standard attribute to hold a string representation for the identity.
5968
- `implicit`: Value `true` indicated an implicit hint (as used today) provided by an accessmethods.
6069

61-
New Hint types my use other attributes.
70+
Type-less former hints are represented by the sole attribute `reference`.
71+
New Hint types may use other attributes.
6272

63-
An access method can provide (and store) implicit hints as before. THose hints are indicated
73+
#### Access Methods
74+
75+
An access method can provide (and store) implicit hints as before. Those hints are indicated
6476
to be implicit. When composing an access method it is only allowed to store implicit hints.
6577
This is completely compatible to the current solution.
6678

67-
Additionally, multiplehints can be stored abd delivered.
79+
Additionally, multiple hints can be stored and delivered.
6880

6981
To support any kind of hint for any scenario, the artifact metadata (resources and sources)
7082
is extended to store explicit hints, which will be part of the normalized form.
7183
This is done by an additional attribute `referenceHints`. It is a list of string maps
7284
holding the hint attributes (including the hint type).
7385

74-
Uploaders are called with the aggrgation of explicit (from metadata) and implicit (from
86+
#### Uploaders
87+
88+
Uploaders are called with the aggregation of explicit (from metadata) and implicit (from
7589
access methods) hints. Hereby, the explicit hints have precedence.
7690

7791
If an uploader creates a local access specification, only implicit hints may be stored, here.
7892

7993
There is a new composition option (`--refhint`) now for composing resources
80-
and sources for the CLI. It accepts an attribute setting. Multiple such options starting with the `type`attribute are used to compose a single hint.
94+
and sources for the CLI. It accepts an attribute setting. Multiple such options starting with the `type` attribute are used to compose a single hint.
95+
96+
#### Inputs
97+
98+
Inputs may provide explicit or implicit hints, now. All file based inputs now allow to specify implicit hints as used before.
99+
The implicit hints (if not conflicting with explicit hints) are used to be stored in `localBlob`
100+
access methods. The explicit hints are used to default the explicit artifact hints.
101+
102+
Hints used in a component version must be unique. This check is extended to consider implicit
103+
and explicit hints provided by inputs, access methods and artifact hints.
104+
105+
Hints may either be specified as a list of string maps (canonical form) or as string using the serialized from.
81106

82107
### Hint Serialization Format
83108

@@ -86,46 +111,40 @@ In general a hint is serialized to the following string
86111
[<*type*>`::]`<*attribute*>`=`<*value*>{`,`<*attribute*>`=`<*value*>}
87112
</center>
88113

89-
The type is not serilaized as attribute. The `implicit` attribute is never serialized is the string is stored in an access specification.
90-
If no type is known the type part is omiited.
114+
The type is not serialized as attribute, but as prefix separated by a `::`. The `implicit` attribute is never serialized if the string is stored in an access specification.
115+
If no type is known the type part is omitted.
91116

92117
A list of hints is serialized to
93118

94119
<center>
95120
&lt;*hint*>{`;`&lt;*hint*>}
96121
</center>
97122

98-
*Attributes* names consist of alpha numeric chaŕacters, only.
99-
If a *value*may not cotain a `::`. If it contains a `;`, `,` or `"`
123+
*Attributes* names consist of alphanumeric characters, only.
124+
A *value* may not contain a `::`. If it contains a `;`, `,` or `"`
100125
character it must be given in double quotes.
101-
In the double quote form any `"` or `\` character has to be escaped by
126+
In the double-quoted form any `"` or `\` character has to be escaped by
102127
a preceding `\` character.
103128

104129
To be as compatible as possible, a single attribute hint with the attribute
105130
`reference` is serialized as naked value (as before) if there are no special
106131
characters enforcing a quoted form.
107132

108-
### Incompatible Changes:
133+
### Incompatible Changes
109134

110-
#### Componwnt Version Representation
135+
#### Component Version Representation
111136

112137
- The new library creates always typed hints for new elements. Old hints are
113-
left as they are. This means, that old versions of the OCM tooling
114-
cannot work correctly with component versions with persisted hints in
138+
left as they are. This means, that old versions of the OCM tooling
139+
cannot work correctly with component versions with persisted hints in
115140
access specifications
116141
- If explicit hints are created, they are not observed by old tool versions.
117142
Those component versions cannot be verified by an older tool version.
118143

119144
#### OCM Library
120145

121-
- The `SetResourceBlob`and `SetSourceBlob` API method no accepts
146+
- The `SetResourceBlob`and `SetSourceBlob` API method no accepts
122147
a hint array instead of a string-based hint.
123-
124148
- Uploaders provided by a plugin now get a serialized hint list
125-
instead of a simple untyped reference format.
126-
-
149+
instead of a simple un-typed reference format.
127150
- There are new options for creating resource(source access objects.
128-
129-
130-
131-

0 commit comments

Comments
 (0)