Skip to content
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

Revert "refactor: use artefact instead of artifact everywhere" #200

Merged
merged 1 commit into from
Nov 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,15 @@ func (s *Spec) GetBlob(ctx inputs.Context, nv common.NameVersion, inputFilePath
s.SetMediaTypeIfNotDefined(mime.MIME_TGZ)
gw := gzip.NewWriter(temp.Writer())
if err := tarutils.TarFileSystem(fs, inputPath, gw, opts); err != nil {
return nil, "", fmt.Errorf("unable to tar input artefact: %w", err)
return nil, "", fmt.Errorf("unable to tar input artifact: %w", err)
}
if err := gw.Close(); err != nil {
return nil, "", fmt.Errorf("unable to close gzip writer: %w", err)
}
} else {
s.SetMediaTypeIfNotDefined(mime.MIME_TAR)
if err := tarutils.TarFileSystem(fs, inputPath, temp.Writer(), opts); err != nil {
return nil, "", fmt.Errorf("unable to tar input artefact: %w", err)
return nil, "", fmt.Errorf("unable to tar input artifact: %w", err)
}
}
return temp.AsBlob(s.MediaType), "", nil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func (s *Spec) getVariant(ctx clictx.Context, finalize *utils.Finalizer, variant

art, err := ns.GetArtefact(version)
if err != nil {
return nil, artefactset.GetArtefactError{Original: err, Ref: version}
return nil, artefactset.GetArtifactError{Original: err, Ref: version}
}
finalize.Close(art)
return art, nil
Expand Down
16 changes: 8 additions & 8 deletions cmds/ocm/commands/ocmcmds/components/sign/cmd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,16 +110,16 @@ var _ = Describe("access method", func() {
prepareEnv(env, ARCH, ARCH)

buf := bytes.NewBuffer(nil)
digest := "53646c07f50e0d5c5e7c0fbc10a8be64a7f1fe24f7cde7868f7e25bacfb8094a"
digest := "05c4edd25661703e0c5caec8b0680c93738d8a8126d825adb755431fec29b7cb"
Expect(env.CatchOutput(buf).Execute("sign", "components", "-s", SIGNATURE, "-K", PRIVKEY, "--repo", ARCH, COMPONENTB+":"+VERSION)).To(Succeed())

Expect(buf.String()).To(StringEqualTrimmedWithContext(`
applying to version "github.com/mandelsoft/ref:v1"...
applying to version "github.com/mandelsoft/test:v1"...
resource 0: "name"="testdata": digest sha256:810ff2fb242a5dee4220f2cb0e6a519891fb67f2f828a6cab4ef8894633b1f50[genericBlobDigest/v1]
resource 1: "name"="value": digest sha256:0c4abdb72cf59cb4b77f4aacb4775f9f546ebc3face189b2224a966c8826ca9f[ociArtefactDigest/v1]
resource 2: "name"="ref": digest sha256:c2d2dca275c33c1270dea6168a002d67c0e98780d7a54960758139ae19984bd7[ociArtefactDigest/v1]
reference 0: github.com/mandelsoft/test:v1: digest sha256:938c211a6016b9c6eca13cbdb0c9ad3e703febb92bbed515b76c8ba95eef9568[jsonNormalisation/v1]
resource 1: "name"="value": digest sha256:0c4abdb72cf59cb4b77f4aacb4775f9f546ebc3face189b2224a966c8826ca9f[ociArtifactDigest/v1]
resource 2: "name"="ref": digest sha256:c2d2dca275c33c1270dea6168a002d67c0e98780d7a54960758139ae19984bd7[ociArtifactDigest/v1]
reference 0: github.com/mandelsoft/test:v1: digest sha256:39ea26ac4391052a638319f64b8da2628acb51d304c3a1ac8f920a46f2d6dce7[jsonNormalisation/v1]
resource 0: "name"="otherdata": digest sha256:54b8007913ec5a907ca69001d59518acfd106f7b02f892eabf9cae3f8b2414b4[genericBlobDigest/v1]
successfully signed github.com/mandelsoft/ref:v1 (digest sha256:` + digest + `)
`))
Expand All @@ -140,16 +140,16 @@ successfully signed github.com/mandelsoft/ref:v1 (digest sha256:` + digest + `)
prepareEnv(env, ARCH2, ARCH)

buf := bytes.NewBuffer(nil)
digest := "53646c07f50e0d5c5e7c0fbc10a8be64a7f1fe24f7cde7868f7e25bacfb8094a"
digest := "05c4edd25661703e0c5caec8b0680c93738d8a8126d825adb755431fec29b7cb"
Expect(env.CatchOutput(buf).Execute("sign", "components", "--lookup", ARCH2, "-s", SIGNATURE, "-K", PRIVKEY, "--repo", ARCH, COMPONENTB+":"+VERSION)).To(Succeed())

Expect(buf.String()).To(StringEqualTrimmedWithContext(`
applying to version "github.com/mandelsoft/ref:v1"...
applying to version "github.com/mandelsoft/test:v1"...
resource 0: "name"="testdata": digest sha256:810ff2fb242a5dee4220f2cb0e6a519891fb67f2f828a6cab4ef8894633b1f50[genericBlobDigest/v1]
resource 1: "name"="value": digest sha256:0c4abdb72cf59cb4b77f4aacb4775f9f546ebc3face189b2224a966c8826ca9f[ociArtefactDigest/v1]
resource 2: "name"="ref": digest sha256:c2d2dca275c33c1270dea6168a002d67c0e98780d7a54960758139ae19984bd7[ociArtefactDigest/v1]
reference 0: github.com/mandelsoft/test:v1: digest sha256:938c211a6016b9c6eca13cbdb0c9ad3e703febb92bbed515b76c8ba95eef9568[jsonNormalisation/v1]
resource 1: "name"="value": digest sha256:0c4abdb72cf59cb4b77f4aacb4775f9f546ebc3face189b2224a966c8826ca9f[ociArtifactDigest/v1]
resource 2: "name"="ref": digest sha256:c2d2dca275c33c1270dea6168a002d67c0e98780d7a54960758139ae19984bd7[ociArtifactDigest/v1]
reference 0: github.com/mandelsoft/test:v1: digest sha256:39ea26ac4391052a638319f64b8da2628acb51d304c3a1ac8f920a46f2d6dce7[jsonNormalisation/v1]
resource 0: "name"="otherdata": digest sha256:54b8007913ec5a907ca69001d59518acfd106f7b02f892eabf9cae3f8b2414b4[genericBlobDigest/v1]
successfully signed github.com/mandelsoft/ref:v1 (digest sha256:` + digest + `)
`))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ var _ = Describe("upload", func() {
config := Must(json.Marshal(ociuploadattr.New(TARGET + grammar.RepositorySeparator + grammar.RepositorySeparator + "copy")))

buf := bytes.NewBuffer(nil)
err := env.CatchOutput(buf).Execute("transfer", "components", "--uploader", "ocm/ociArtefacts="+string(config), "--copy-resources", CTF, COPY)
err := env.CatchOutput(buf).Execute("transfer", "components", "--uploader", "ocm/ociArtifacts="+string(config), "--copy-resources", CTF, COPY)
if err != nil {
fmt.Printf("%s\n", buf.String())
Expect(err).To(Succeed())
Expand Down
8 changes: 4 additions & 4 deletions cmds/ocm/commands/ocmcmds/components/verify/cmd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ var _ = Describe("access method", func() {

It("sign component archive", func() {
buf := bytes.NewBuffer(nil)
digest := "53646c07f50e0d5c5e7c0fbc10a8be64a7f1fe24f7cde7868f7e25bacfb8094a"
digest := "05c4edd25661703e0c5caec8b0680c93738d8a8126d825adb755431fec29b7cb"

session := datacontext.NewSession()
defer session.Close()
Expand Down Expand Up @@ -148,9 +148,9 @@ var _ = Describe("access method", func() {
applying to version "github.com/mandelsoft/ref:v1"...
applying to version "github.com/mandelsoft/test:v1"...
resource 0: "name"="testdata": digest sha256:810ff2fb242a5dee4220f2cb0e6a519891fb67f2f828a6cab4ef8894633b1f50[genericBlobDigest/v1]
resource 1: "name"="value": digest sha256:0c4abdb72cf59cb4b77f4aacb4775f9f546ebc3face189b2224a966c8826ca9f[ociArtefactDigest/v1]
resource 2: "name"="ref": digest sha256:c2d2dca275c33c1270dea6168a002d67c0e98780d7a54960758139ae19984bd7[ociArtefactDigest/v1]
reference 0: github.com/mandelsoft/test:v1: digest sha256:938c211a6016b9c6eca13cbdb0c9ad3e703febb92bbed515b76c8ba95eef9568[jsonNormalisation/v1]
resource 1: "name"="value": digest sha256:0c4abdb72cf59cb4b77f4aacb4775f9f546ebc3face189b2224a966c8826ca9f[ociArtifactDigest/v1]
resource 2: "name"="ref": digest sha256:c2d2dca275c33c1270dea6168a002d67c0e98780d7a54960758139ae19984bd7[ociArtifactDigest/v1]
reference 0: github.com/mandelsoft/test:v1: digest sha256:39ea26ac4391052a638319f64b8da2628acb51d304c3a1ac8f920a46f2d6dce7[jsonNormalisation/v1]
resource 0: "name"="otherdata": digest sha256:54b8007913ec5a907ca69001d59518acfd106f7b02f892eabf9cae3f8b2414b4[genericBlobDigest/v1]
successfully verified github.com/mandelsoft/ref:v1 (digest sha256:` + digest + `)
`))
Expand Down
2 changes: 1 addition & 1 deletion cmds/ocm/commands/ocmcmds/sourceconfig/add/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ Add a source specification to a source config file used by <CMD>ocm add sources<
` + o.Adder.Description() + ` Elements must follow the resource meta data
description scheme of the component descriptor.

If not specified anywhere the artefact type will be defaulted to <code>` + resourcetypes.FILESYSTEM + `</code>.
If not specified anywhere the artifact type will be defaulted to <code>` + resourcetypes.FILESYSTEM + `</code>.

If expressions/templates are used in the specification file an appropriate
templater and the required settings might be required to provide
Expand Down
2 changes: 1 addition & 1 deletion cmds/ocm/commands/ocmcmds/sourceconfig/add/cmd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ type: PlainText
`)
})

It("defaults artefact type", func() {
It("defaults artifact type", func() {
access := `
type: gitHub
repoUrl: github.com/open-component-model/ocm
Expand Down
6 changes: 3 additions & 3 deletions cmds/ocm/topics/ocm/accessmethods/topic.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ func New(ctx clictx.Context) *cobra.Command {
Short: "List of all supported access methods",

Long: `
Access methods are used to handle the access to the content of artefacts
described in a component version. Therefore, an artefact entry contains
Access methods are used to handle the access to the content of artifacts
described in a component version. Therefore, an artifact entry contains
an access specification describing the access attributes for the dedicated
artefact.
artifact.

` + ocm.AccessUsage(ctx.OCMContext().AccessMethods(), true),
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
# Centrally Artefact Normalization Algorithms
# Centrally Artifact Normalization Algorithms


To be able to sign a component version, the content of described artefacts
must be incorporated. Therefore, a digest for the artefact content must be
To be able to sign a component version, the content of described artifacts
must be incorporated. Therefore, a digest for the artifact content must be
determined.

By default, this digest is calculated based on the blob provided by the
[access method](../../ocm/model.md#artefact-access)
of an artefact. But there might be technology specific ways to uniquely identify
the content for dedicated artefact types.
of an artifact. But there might be technology specific ways to uniquely identify
the content for dedicated artifact types.

Therefore, together with the digest and its algorithm, an artefact normalization
Therefore, together with the digest and its algorithm, an artifact normalization
algorithm is kept in the [component descriptor](../../ocm/model.md#component-descriptor).

The following algorithms are centrally defined and available in the OCM toolset:

- `ociArtefactDigest/v1`: OCI manifest digest
- `ociArtifactDigest/v1`: OCI manifest digest

This algorithm is used for artefacts of type `ociArtefact`. It just uses the
manifest digest of the OCI artefact.
This algorithm is used for artifacts of type `ociArtefact`. It just uses the
manifest digest of the OCI artifact.

- `genericBlobDigest/v1`: Blob byte stream digest

This is the default normalization algorithm. It just uses the blob content
provided by the access method of an OCM artefact to calculate the digest.
It is always used, if no special digester is available for an artefact type.
provided by the access method of an OCM artifact to calculate the digest.
It is always used, if no special digester is available for an artifact type.
28 changes: 14 additions & 14 deletions docs/ocm/model.md
Original file line number Diff line number Diff line change
Expand Up @@ -605,28 +605,28 @@ There may be multiple signatures. Every signature is defined by its name, a type
a normalization algorithm, a digest and a digest algorithm used to calculate the digest
on the normalization.

### Artefact Digests
### Artifact Digests

Signing of a component version incorporates the described artefacts
(resources and sources). Therefore, the artefact content is digested.
Signing of a component version incorporates the described artifacts
(resources and sources). Therefore, the artifact content is digested.
This digest is then incorporated into the digest of a component version.

Because every artefact is provided in dedicated blob formats, such
Because every artifact is provided in dedicated blob formats, such
a digest can be calculated based on this blob. This is the default behaviour.
Nevertheless, there might be technology specific ways to provide an immutable
digest for a dedicated type of artefact. For example, an OCI artefact
digest for a dedicated type of artifact. For example, an OCI artifact
is always uniquely identified by its manifest digest. This can be exploited
for the calculation of OCM artefact digests.
for the calculation of OCM artifact digests.

Together with the digest and its algorithm, for example SHA-256, a
normalization is kept for an artefact. This algorithm specifies the way
the digest is determined. For example, for OCI artefacts, the algorithm
`ociArtefactDigest/v1` is used by default. This behaviour can be controlled by
appropriate digest handlers. Supported algorithms can be found [here](../formats/artefactdigests/README.md).

If the digest algorithm `NO-DIGEST` is specified for an artefact,
this artefact content is not included into the component version digest.
This is typically configured for source artefacts, which are not deliverable.
normalization is kept for an artifact. This algorithm specifies the way
the digest is determined. For example, for OCI artifacts, the algorithm
`ociArtifactDigest/v1` is used by default. This behaviour can be controlled by
appropriate digest handlers. Supported algorithms can be found [here](../formats/artifactdigests/README.md).

If the digest algorithm `NO-DIGEST` is specified for an artifact,
this artifact content is not included into the component version digest.
This is typically configured for source artifacts, which are not deliverable.

### Component Version Digests

Expand Down
4 changes: 2 additions & 2 deletions docs/ocm/normalization.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ The [component descriptor](../formats/compdesc/README.md) is used to describe
a [component version](model.md#component-versions). It contains several kinds
of information:
- volatile label settings, which might be changeable.
- artefact access information, which might be changed during transport steps.
- static information describing the features and artefacts of a component
- artifact access information, which might be changed during transport steps.
- static information describing the features and artifacts of a component
version.

<!-- If a component version should be signed, to be able to verify its authenticity
Expand Down
4 changes: 2 additions & 2 deletions docs/pluginreference/plugin_accessmethod_compose.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ The following predefined option types can be used:
- <code>commit</code>: [*string*] git commit id
- <code>digest</code>: [*string*] blob digest
- <code>globalAccess</code>: [*map[string]YAML*] access specification for global access
- <code>hint</code>: [*string*] (repository) hint for local artefacts
- <code>mediaType</code>: [*string*] media type for artefact blob representation
- <code>hint</code>: [*string*] (repository) hint for local artifacts
- <code>mediaType</code>: [*string*] media type for artifact blob representation
- <code>reference</code>: [*string*] reference name
- <code>region</code>: [*string*] region name
- <code>size</code>: [*int*] blob size
Expand Down
2 changes: 1 addition & 1 deletion docs/pluginreference/plugin_accessmethod_validate.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ following fields:

- **<code>mediaType</code>** *string*

The media type of the artefact described by the specification. It may be part
The media type of the artifact described by the specification. It may be part
of the specification or implicitly determined by the access method.

- **<code>description</code>** *string*
Expand Down
22 changes: 11 additions & 11 deletions docs/pluginreference/plugin_descriptor.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ following fields:
- **<code>downloaders</code>** *[]DownloaderDescriptor*

The list of supported downloaders. Downloaders will be used by the
CLI download command to provide downloaded artefacts in a filesystem format
CLI download command to provide downloaded artifacts in a filesystem format
applicable to the type specific tools, regatdless of the format it is stored
as blob in a component version. Therefore they can be registered for
combination of artefact type and optional mime type (describing the actually
combination of artifact type and optional mime type (describing the actually
used blob format).

#### Access Method Descriptor
Expand Down Expand Up @@ -110,8 +110,8 @@ The following predefined option types can be used:
- <code>commit</code>: [*string*] git commit id
- <code>digest</code>: [*string*] blob digest
- <code>globalAccess</code>: [*map[string]YAML*] access specification for global access
- <code>hint</code>: [*string*] (repository) hint for local artefacts
- <code>mediaType</code>: [*string*] media type for artefact blob representation
- <code>hint</code>: [*string*] (repository) hint for local artifacts
- <code>mediaType</code>: [*string*] media type for artifact blob representation
- <code>reference</code>: [*string*] reference name
- <code>region</code>: [*string*] region name
- <code>size</code>: [*int*] blob size
Expand Down Expand Up @@ -145,13 +145,13 @@ The descriptor for an uploader has the following fields:
The list of constraints the uploader is usable for. A constraint is described
by two fields:

- **<code>artefactType</code>** *string*
- **<code>artifactType</code>** *string*

Restrict the usage to a dedicated artefact type.
Restrict the usage to a dedicated artifact type.

- **<code>mediaType</code>** *string*

Restrict the usage to a dedicated media type of the artefact blob.
Restrict the usage to a dedicated media type of the artifact blob.

- **<code>contextType</code>** *string*

Expand Down Expand Up @@ -180,13 +180,13 @@ The descriptor for a downloader has the following fields:
The list of constraints the downloader is usable for. A constraint is described
by two fields:

- **<code>artefactType</code>** *string*
- **<code>artifactType</code>** *string*

Restrict the usage to a dedicated artefact type.
Restrict the usage to a dedicated artifact type.

- **<code>mediaType</code>** *string* (optional)

Restrict the usage to a dedicated media type of the artefact blob.
Restrict the usage to a dedicated media type of the artifact blob.


### Examples
Expand Down Expand Up @@ -215,7 +215,7 @@ The descriptor for a downloader has the following fields:
{
"constraints": [
{
"artefactType": "TestArtefact"
"artifactType": "TestArtefact"
}
],
"name": "testuploader"
Expand Down
4 changes: 2 additions & 2 deletions docs/pluginreference/plugin_download.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ plugin download [<flags>] <name> <filepath> [<options>]
### Options

```
-a, --artefactType string artefact type of input blob
-a, --artifactType string artifact type of input blob
-h, --help help for download
-m, --mediaType string media type of input blob
```
Expand All @@ -23,7 +23,7 @@ to store the downloaded content. The blob content is provided on the

The task of this command is to transform the content of the provided
blob into a filesystem structure applicable to the type specific tools working
with content of the given artefact type.
with content of the given artifact type.


### SEE ALSO
Expand Down
2 changes: 1 addition & 1 deletion docs/pluginreference/plugin_upload_put.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ plugin upload put [<flags>] <name> <repository specification> [<options>]
### Options

```
-a, --artefactType string artefact type of input blob
-a, --artifactType string artifact type of input blob
-C, --credential <name>=<value> dedicated credential value
-c, --credentials YAML credentials
-h, --help help for put
Expand Down
2 changes: 1 addition & 1 deletion docs/pluginreference/plugin_upload_validate.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ plugin upload validate [<flags>] <name> <spec> [<options>]
### Options

```
-a, --artefactType string artefact type of input blob
-a, --artifactType string artifact type of input blob
-h, --help help for validate
-m, --mediaType string media type of input blob
```
Expand Down
Loading