Skip to content

Commit 15662f6

Browse files
committed
adapt ADR
1 parent dcfa333 commit 15662f6

File tree

2 files changed

+45
-24
lines changed

2 files changed

+45
-24
lines changed

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

+44-23
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,52 @@
1-
# Architectural Decision Record: Rework of Referebce Hints
1+
# ADR-0003 - Rework of Reference Hints
22

3+
* Status: proposed
4+
* Date: 2014-12-27
5+
* Authors: @mandelsoft
6+
* Deciders: @fabianburth @jakobmoellerdev
7+
* Reference Implementation:
38
### Meaning of Reference Hints
49

510
During the transport of software artifacts referenced from external artifact repositories like
611
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
12+
`localBlob`). If those component versions are transported again into a repository landscape they
813
might be uploaded again to external repositories.
914

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

1318
### Current Solution
1419

15-
The access method origibally used to refernce the exterbal artfact provides a reference hint,
20+
The access method originally used to reference the external artifact provides a reference hint,
1621
which can later be used by the blob uploaders to reconstruct a useful identity.
1722
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.
23+
The hint is just a string, which needs to be interpreted by the uploader.
1924

2025
### Problems with Current Solution
2126

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
27+
The assumption behind the current solution is that the uploader will always upload the
28+
artifact into a similar repository, again. Therefore, there would be a one-to-one relation
2429
between access method and uploader.
2530

2631
Unfortunately this is not true in all cases:
2732
- 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.
33+
with different natural repository types and identity schemes.
2934
- Therefore,
3035
- it can neither provide an implicit reference hint anymore
3136
- nor there is a one-to-one relation to a typed uploader anymore.
3237
- artifacts might be uploadable to different repository types using different
3338
identity schemes.
3439

3540
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
41+
similar to the `localBlob` access method. But this can only be a workaround, because
42+
- the hint is not typed and potential target repositories might use different identity schemes
3843
- it is possible to store a single hint, only.
3944

4045
### Proposed Solution
4146

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

4651
To be compatible a serialization format is defined for a list of type hints, which maps such
4752
a list to a single string.
@@ -51,33 +56,49 @@ a formal hint, by providing access to a set of string attributes. There are thre
5156
attributes:
5257
- `type` the formal type of the hint (may be empty to cover old component versions)
5358
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
59+
- `oci`: OCI identity given by the attribute `reference` with the currently used format
5560
- `maven`: Maven identity (GAV) given by the attribute `reference` with the currently used format
5661
- `npm`: Node package identity given by the attribute `reference` with the currently used
5762
format
5863
- `reference`: the standard attribute to hold a string representation for the identity.
5964
- `implicit`: Value `true` indicated an implicit hint (as used today) provided by an accessmethods.
6065

61-
New Hint types my use other attributes.
66+
Typeless former hints are represented by the sole attribute `reference`.
67+
New Hint types may use other attributes.
6268

63-
An access method can provide (and store) implicit hints as before. THose hints are indicated
69+
#### Access Methods
70+
71+
An access method can provide (and store) implicit hints as before. Those hints are indicated
6472
to be implicit. When composing an access method it is only allowed to store implicit hints.
6573
This is completely compatible to the current solution.
6674

67-
Additionally, multiplehints can be stored abd delivered.
75+
Additionally, multiple hints can be stored abd delivered.
6876

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

74-
Uploaders are called with the aggrgation of explicit (from metadata) and implicit (from
82+
#### Uploaders
83+
84+
Uploaders are called with the aggregation of explicit (from metadata) and implicit (from
7585
access methods) hints. Hereby, the explicit hints have precedence.
7686

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

7989
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.
90+
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.
91+
92+
#### Inputs
93+
94+
Inputs may provide explicit or implicit hints, now. All file based inputs now allow to specify implicit hints as used before.
95+
The implicit hints (if not conflicting with explicit hints) are used to be stored in `localBlob`
96+
access methods. The explicit hints are used to default the explicit artifact hints.
97+
98+
Hints used in a component version must be unique. This check is extended to consider implicit
99+
and explicit hints provided by inputs, access methods and artifact hints.
100+
101+
Hints may either be specified as a list of string maps (canonical form) or as string using the serialized from.
81102

82103
### Hint Serialization Format
83104

@@ -86,19 +107,19 @@ In general a hint is serialized to the following string
86107
[<*type*>`::]`<*attribute*>`=`<*value*>{`,`<*attribute*>`=`<*value*>}
87108
</center>
88109

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.
110+
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.
111+
If no type is known the type part is omitted.
91112

92113
A list of hints is serialized to
93114

94115
<center>
95116
&lt;*hint*>{`;`&lt;*hint*>}
96117
</center>
97118

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

104125
To be as compatible as possible, a single attribute hint with the attribute
@@ -107,7 +128,7 @@ characters enforcing a quoted form.
107128

108129
### Incompatible Changes:
109130

110-
#### Componwnt Version Representation
131+
#### Component Version Representation
111132

112133
- The new library creates always typed hints for new elements. Old hints are
113134
left as they are. This means, that old versions of the OCM tooling

0 commit comments

Comments
 (0)