Skip to content

Commit

Permalink
Maven/access2 (#731)
Browse files Browse the repository at this point in the history
## Description

Let's assume you have the following `component-constructor.yaml`:

```yaml
name: acme.org/foo/bar
version: 0.0.1
provider:
  name: acme.org
resources:
  - name: java-sap-vcap-services
    type: mvnArtifact # new TYPE!
    version: 0.0.1
    access:
      type: mvn # new TYPE!
      repository: https://repo1.maven.org/maven2
      groupId: com.sap.cloud.environment.servicebinding
      artifactId: java-sap-vcap-services
      version: 0.10.4
      # (optional) classifier
      classifier: ''
      # (optional) extension
      extension: jar
```

Then you can now create a component version:

```bash
ocm add componentversions --create -F ./ctf component-constructor.yaml
```

And you can transfer it to any other Maven repository:

```bash
ocm transfer cv -V ./ctf ./target --uploader 'ocm/mvnArtifact="Url":"https://my.maven.repository.acme.org/artifactory/ocm-mvn-test"}'
```

You might need to configure proper credentials in your `~/.ocmconfig`:

```yaml
type: generic.config.ocm.software/v1
configurations:
  - type: credentials.config.ocm.software
    consumers:
      - identity:
          type: Repository.maven.apache.org
          hostname: int.repositories.cloud.sap
          path: artifactory/ocm-mvn-test
        credentials:
          - type: Credentials
            properties:
              username: 'my-user'
              password: 'top-secret'
```
  • Loading branch information
hilmarf authored May 21, 2024
1 parent 93c6bad commit 93412ff
Show file tree
Hide file tree
Showing 60 changed files with 2,423 additions and 280 deletions.
4 changes: 0 additions & 4 deletions .reuse/dep5
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@ Files: **
Copyright: 2024 SAP SE or an SAP affiliate company and Open Component Model contributors
License: Apache-2.0

Files: pkg/mimeutils/*
Copyright: Copyright 2010 The Go Authors. All rights reserved.
License: BSD-3-Clause

Files: pkg/contexts/ocm/blobhandler/handlers/generic/npm/publish.go
Copyright: Copyright 2021 - cloverstd
License: MIT
11 changes: 0 additions & 11 deletions LICENSES/BSD-3-Clause.txt

This file was deleted.

3 changes: 3 additions & 0 deletions docs/pluginreference/plugin_accessmethod_compose.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ by the plugin name.
The following predefined option types can be used:


- <code>accessClassifier</code>: [*string*] mvn classifier
- <code>accessExtension</code>: [*string*] mvn extension name
- <code>accessGroup</code>: [*string*] GroupID or namespace
- <code>accessHostname</code>: [*string*] hostname used for access
- <code>accessPackage</code>: [*string*] package or object name
- <code>accessRegistry</code>: [*string*] registry base URL
Expand Down
3 changes: 3 additions & 0 deletions docs/pluginreference/plugin_descriptor.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@ It uses the following fields:
The following predefined option types can be used:


- <code>accessClassifier</code>: [*string*] mvn classifier
- <code>accessExtension</code>: [*string*] mvn extension name
- <code>accessGroup</code>: [*string*] GroupID or namespace
- <code>accessHostname</code>: [*string*] hostname used for access
- <code>accessPackage</code>: [*string*] package or object name
- <code>accessRegistry</code>: [*string*] registry base URL
Expand Down
3 changes: 3 additions & 0 deletions docs/pluginreference/plugin_valueset_compose.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ by the plugin name.
The following predefined option types can be used:


- <code>accessClassifier</code>: [*string*] mvn classifier
- <code>accessExtension</code>: [*string*] mvn extension name
- <code>accessGroup</code>: [*string*] GroupID or namespace
- <code>accessHostname</code>: [*string*] hostname used for access
- <code>accessPackage</code>: [*string*] package or object name
- <code>accessRegistry</code>: [*string*] registry base URL
Expand Down
38 changes: 38 additions & 0 deletions docs/reference/ocm_add_resource-configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ resource-configuration, resourceconfig, rsccfg, rcfg

```
--access YAML blob access specification (YAML)
--accessClassifier string mvn classifier
--accessExtension string mvn extension name
--accessGroup string GroupID or namespace
--accessHostname string hostname used for access
--accessPackage string package or object name
--accessRegistry string registry base URL
Expand Down Expand Up @@ -680,6 +683,41 @@ shown below.

Options used to configure fields: <code>--globalAccess</code>, <code>--hint</code>, <code>--mediaType</code>, <code>--reference</code>

- Access type <code>mvn</code>

This method implements the access of a Maven (mvn) artifact in a Maven repository.

The following versions are supported:
- Version <code>v1</code>

The type specific specification fields are:

- **<code>repository</code>** *string*

Base URL of the Maven (mvn) repository

- **<code>groupId</code>** *string*

The groupId of the Maven (mvn) artifact

- **<code>artifactId</code>** *string*

The artifactId of the Maven (mvn) artifact

- **<code>version</code>** *string*

The version name of the Maven (mvn) artifact

- **<code>classifier</code>** *string*

The optional classifier of the Maven (mvn) artifact

- **<code>extension</code>** *string*

The optional extension of the Maven (mvn) artifact

Options used to configure fields: <code>--accessClassifier</code>, <code>--accessExtension</code>, <code>--accessGroup</code>, <code>--accessPackage</code>, <code>--accessRepository</code>, <code>--accessVersion</code>

- Access type <code>none</code>

dummy resource with no access
Expand Down
38 changes: 38 additions & 0 deletions docs/reference/ocm_add_resources.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ resources, resource, res, r

```
--access YAML blob access specification (YAML)
--accessClassifier string mvn classifier
--accessExtension string mvn extension name
--accessGroup string GroupID or namespace
--accessHostname string hostname used for access
--accessPackage string package or object name
--accessRegistry string registry base URL
Expand Down Expand Up @@ -690,6 +693,41 @@ shown below.

Options used to configure fields: <code>--globalAccess</code>, <code>--hint</code>, <code>--mediaType</code>, <code>--reference</code>

- Access type <code>mvn</code>

This method implements the access of a Maven (mvn) artifact in a Maven repository.

The following versions are supported:
- Version <code>v1</code>

The type specific specification fields are:

- **<code>repository</code>** *string*

Base URL of the Maven (mvn) repository

- **<code>groupId</code>** *string*

The groupId of the Maven (mvn) artifact

- **<code>artifactId</code>** *string*

The artifactId of the Maven (mvn) artifact

- **<code>version</code>** *string*

The version name of the Maven (mvn) artifact

- **<code>classifier</code>** *string*

The optional classifier of the Maven (mvn) artifact

- **<code>extension</code>** *string*

The optional extension of the Maven (mvn) artifact

Options used to configure fields: <code>--accessClassifier</code>, <code>--accessExtension</code>, <code>--accessGroup</code>, <code>--accessPackage</code>, <code>--accessRepository</code>, <code>--accessVersion</code>

- Access type <code>none</code>

dummy resource with no access
Expand Down
38 changes: 38 additions & 0 deletions docs/reference/ocm_add_source-configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ source-configuration, sourceconfig, srccfg, scfg

```
--access YAML blob access specification (YAML)
--accessClassifier string mvn classifier
--accessExtension string mvn extension name
--accessGroup string GroupID or namespace
--accessHostname string hostname used for access
--accessPackage string package or object name
--accessRegistry string registry base URL
Expand Down Expand Up @@ -680,6 +683,41 @@ shown below.

Options used to configure fields: <code>--globalAccess</code>, <code>--hint</code>, <code>--mediaType</code>, <code>--reference</code>

- Access type <code>mvn</code>

This method implements the access of a Maven (mvn) artifact in a Maven repository.

The following versions are supported:
- Version <code>v1</code>

The type specific specification fields are:

- **<code>repository</code>** *string*

Base URL of the Maven (mvn) repository

- **<code>groupId</code>** *string*

The groupId of the Maven (mvn) artifact

- **<code>artifactId</code>** *string*

The artifactId of the Maven (mvn) artifact

- **<code>version</code>** *string*

The version name of the Maven (mvn) artifact

- **<code>classifier</code>** *string*

The optional classifier of the Maven (mvn) artifact

- **<code>extension</code>** *string*

The optional extension of the Maven (mvn) artifact

Options used to configure fields: <code>--accessClassifier</code>, <code>--accessExtension</code>, <code>--accessGroup</code>, <code>--accessPackage</code>, <code>--accessRepository</code>, <code>--accessVersion</code>

- Access type <code>none</code>

dummy resource with no access
Expand Down
38 changes: 38 additions & 0 deletions docs/reference/ocm_add_sources.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ sources, source, src, s

```
--access YAML blob access specification (YAML)
--accessClassifier string mvn classifier
--accessExtension string mvn extension name
--accessGroup string GroupID or namespace
--accessHostname string hostname used for access
--accessPackage string package or object name
--accessRegistry string registry base URL
Expand Down Expand Up @@ -688,6 +691,41 @@ shown below.

Options used to configure fields: <code>--globalAccess</code>, <code>--hint</code>, <code>--mediaType</code>, <code>--reference</code>

- Access type <code>mvn</code>

This method implements the access of a Maven (mvn) artifact in a Maven repository.

The following versions are supported:
- Version <code>v1</code>

The type specific specification fields are:

- **<code>repository</code>** *string*

Base URL of the Maven (mvn) repository

- **<code>groupId</code>** *string*

The groupId of the Maven (mvn) artifact

- **<code>artifactId</code>** *string*

The artifactId of the Maven (mvn) artifact

- **<code>version</code>** *string*

The version name of the Maven (mvn) artifact

- **<code>classifier</code>** *string*

The optional classifier of the Maven (mvn) artifact

- **<code>extension</code>** *string*

The optional extension of the Maven (mvn) artifact

Options used to configure fields: <code>--accessClassifier</code>, <code>--accessExtension</code>, <code>--accessGroup</code>, <code>--accessPackage</code>, <code>--accessRepository</code>, <code>--accessVersion</code>

- Access type <code>none</code>

dummy resource with no access
Expand Down
1 change: 1 addition & 0 deletions docs/reference/ocm_controller_install.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ ocm controller install controller {--version v0.0.1}
-i, --install-prerequisites install prerequisites required by ocm-controller (default true)
-n, --namespace string the namespace into which the controller is installed (default "ocm-system")
-a, --release-api-url string the base url to the ocm-controller's API release page (default "https://api.github.com/repos/open-component-model/ocm-controller/releases")
-l, --silent don't fail on error
-s, --skip-pre-flight-check skip the pre-flight check for clusters
-t, --timeout duration maximum time to wait for deployment to be ready (default 1m0s)
-v, --version string the version of the controller to install (default "latest")
Expand Down
1 change: 1 addition & 0 deletions docs/reference/ocm_controller_uninstall.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ ocm controller uninstall controller
-h, --help help for uninstall
-n, --namespace string the namespace into which the controller is installed (default "ocm-system")
-a, --release-api-url string the base url to the ocm-controller's API release page (default "https://api.github.com/repos/open-component-model/ocm-controller/releases")
-l, --silent don't fail on error
-t, --timeout duration maximum time to wait for deployment to be ready (default 1m0s)
-p, --uninstall-prerequisites uninstall prerequisites required by ocm-controller
-v, --version string the version of the controller to install (default "latest")
Expand Down
27 changes: 19 additions & 8 deletions docs/reference/ocm_credential-handling.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,32 +156,43 @@ The following credential consumer types are used/supported:
- <code>certificateAuthority</code>: TLS certificate authority


- <code>OCIRegistry</code>: OCI registry credential matcher
- <code>MavenRepository</code>: MVN repository

It matches the <code>OCIRegistry</code> consumer type and additionally acts like
It matches the <code>MavenRepository</code> consumer type and additionally acts like
the <code>hostpath</code> type.

Credential consumers of the consumer type OCIRegistry evaluate the following credential properties:
Credential consumers of the consumer type MavenRepository evaluate the following credential properties:

- <code>username</code>: the basic auth user name
- <code>password</code>: the basic auth password
- <code>identityToken</code>: the bearer token used for non-basic auth authorization
- <code>certificateAuthority</code>: the certificate authority certificate used to verify certificates


- <code>Registry.npmjs.com</code>: NPM repository
- <code>NpmRegistry</code>: NPM repository

It matches the <code>Registry.npmjs.com</code> consumer type and additionally acts like
It matches the <code>NpmRegistry</code> consumer type and additionally acts like
the <code>hostpath</code> type.

Credential consumers of the consumer type Registry.npmjs.com evaluate the following credential properties:
Credential consumers of the consumer type NpmRegistry evaluate the following credential properties:

- <code>username</code>: the basic auth user name
- <code>password</code>: the basic auth password
- <code>email</code>: NPM registry, require an email address
- <code>token</code>: the token attribute. May exist after login at any npm registry. Check your .npmrc file!


- <code>OCIRegistry</code>: OCI registry credential matcher

It matches the <code>OCIRegistry</code> consumer type and additionally acts like
the <code>hostpath</code> type.

Credential consumers of the consumer type OCIRegistry evaluate the following credential properties:

- <code>username</code>: the basic auth user name
- <code>password</code>: the basic auth password
- <code>identityToken</code>: the bearer token used for non-basic auth authorization
- <code>certificateAuthority</code>: the certificate authority certificate used to verify certificates


- <code>S3</code>: S3 credential matcher

This matcher is a hostpath matcher.
Expand Down
27 changes: 19 additions & 8 deletions docs/reference/ocm_get_credentials.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,32 +82,43 @@ Matchers exist for the following usage contexts or consumer types:
- <code>certificateAuthority</code>: TLS certificate authority


- <code>OCIRegistry</code>: OCI registry credential matcher
- <code>MavenRepository</code>: MVN repository

It matches the <code>OCIRegistry</code> consumer type and additionally acts like
It matches the <code>MavenRepository</code> consumer type and additionally acts like
the <code>hostpath</code> type.

Credential consumers of the consumer type OCIRegistry evaluate the following credential properties:
Credential consumers of the consumer type MavenRepository evaluate the following credential properties:

- <code>username</code>: the basic auth user name
- <code>password</code>: the basic auth password
- <code>identityToken</code>: the bearer token used for non-basic auth authorization
- <code>certificateAuthority</code>: the certificate authority certificate used to verify certificates


- <code>Registry.npmjs.com</code>: NPM repository
- <code>NpmRegistry</code>: NPM repository

It matches the <code>Registry.npmjs.com</code> consumer type and additionally acts like
It matches the <code>NpmRegistry</code> consumer type and additionally acts like
the <code>hostpath</code> type.

Credential consumers of the consumer type Registry.npmjs.com evaluate the following credential properties:
Credential consumers of the consumer type NpmRegistry evaluate the following credential properties:

- <code>username</code>: the basic auth user name
- <code>password</code>: the basic auth password
- <code>email</code>: NPM registry, require an email address
- <code>token</code>: the token attribute. May exist after login at any npm registry. Check your .npmrc file!


- <code>OCIRegistry</code>: OCI registry credential matcher

It matches the <code>OCIRegistry</code> consumer type and additionally acts like
the <code>hostpath</code> type.

Credential consumers of the consumer type OCIRegistry evaluate the following credential properties:

- <code>username</code>: the basic auth user name
- <code>password</code>: the basic auth password
- <code>identityToken</code>: the bearer token used for non-basic auth authorization
- <code>certificateAuthority</code>: the certificate authority certificate used to verify certificates


- <code>S3</code>: S3 credential matcher

This matcher is a hostpath matcher.
Expand Down
3 changes: 2 additions & 1 deletion docs/reference/ocm_logging.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ The following *tags* are used by the command line tool:

The following *realms* are used by the command line tool:
- <code>ocm</code>: general realm used for the ocm go library.
- <code>ocm/NPM</code>: NPM registry
- <code>ocm/accessmethod/ociartifact</code>: access method ociArtifact
- <code>ocm/accessmethod/wget</code>: access method for wget
- <code>ocm/blobaccess/wget</code>: blob access for wget
Expand All @@ -28,6 +27,8 @@ The following *realms* are used by the command line tool:
- <code>ocm/credentials/dockerconfig</code>: docker config handling as credential repository
- <code>ocm/credentials/vault</code>: HashiCorp Vault Access
- <code>ocm/downloader</code>: Downloaders
- <code>ocm/mvn</code>: Maven repository
- <code>ocm/npm</code>: NPM registry
- <code>ocm/oci/mapping</code>: OCM to OCI Registry Mapping
- <code>ocm/oci/ocireg</code>: OCI repository handling
- <code>ocm/plugins</code>: OCM plugin handling
Expand Down
Loading

0 comments on commit 93412ff

Please sign in to comment.