Skip to content

feat: update plugin contract add UploadResources#1751

Merged
fabianburth merged 10 commits into
open-component-model:mainfrom
matthiasbruns:feat/resource_plugin_with_credentials
Feb 10, 2026
Merged

feat: update plugin contract add UploadResources#1751
fabianburth merged 10 commits into
open-component-model:mainfrom
matthiasbruns:feat/resource_plugin_with_credentials

Conversation

@matthiasbruns

@matthiasbruns matthiasbruns commented Feb 10, 2026

Copy link
Copy Markdown
Contributor

What this PR does / why we need it

Required plugin contract update for Resources to be able to upload resources.
It also implements repository.ResourceRepository in ResourceRegistry.
Additionally, the tests used a deprecated blob construction and was updated to use the new prefered way

old:
blob.NewDirectReadOnlyBlob
new:
inmemory.New

Part of #1684

This PR aligns the plugin resource contract with the updated repository.ResourceRepository

// Repository defines the interface for storing and retrieving OCM resources
// independently of component versions from a Store Implementation
type Repository interface {
	// GetResourceCredentialConsumerIdentity resolves the identity of the given [descriptor.Resource] to use for credential resolution.
	GetResourceCredentialConsumerIdentity(ctx context.Context, resource *descriptor.Resource) (runtime.Identity, error)
	// UploadResource uploads a [descriptor.Resource] to the repository.
	// Returns the updated resource with repository-specific information.
	// The resource must be referenced in the component descriptor.
	// The credentials map must contain necessary authentication information to access the resource.
	UploadResource(ctx context.Context, res *descriptor.Resource, content blob.ReadOnlyBlob, credentials map[string]string) (*descriptor.Resource, error)
	// DownloadResource downloads and verifies the integrity of a [descriptor.Resource] from the repository.
	DownloadResource(ctx context.Context, res *descriptor.Resource, credentials map[string]string) (blob.ReadOnlyBlob, error)
}

Which issue(s) this PR fixes

Contributes: open-component-model/ocm-project#796

On-behalf-of: SAP <matthias.bruns@sap.com>
Signed-off-by: Matthias Bruns <git@matthiasbruns.com>
@github-actions github-actions Bot added kind/feature new feature, enhancement, improvement, extension size/m Medium labels Feb 10, 2026
On-behalf-of: SAP <matthias.bruns@sap.com>
Signed-off-by: Matthias Bruns <git@matthiasbruns.com>
@github-actions github-actions Bot added the size/s Small label Feb 10, 2026
@matthiasbruns matthiasbruns changed the title feat(796): update plugin contract to use credentials feat!: BREAKING CHANGE: update plugin contract to use credentials Feb 10, 2026
@matthiasbruns matthiasbruns added the !BREAKING-CHANGE! Breaking change in API or ocm-cli or spec label Feb 10, 2026
On-behalf-of: SAP <matthias.bruns@sap.com>
Signed-off-by: Matthias Bruns <git@matthiasbruns.com>
@matthiasbruns matthiasbruns changed the title feat!: BREAKING CHANGE: update plugin contract to use credentials feat!: BREAKING CHANGE: update plugin contract add UploadResources Feb 10, 2026
@matthiasbruns matthiasbruns removed the !BREAKING-CHANGE! Breaking change in API or ocm-cli or spec label Feb 10, 2026
@matthiasbruns matthiasbruns changed the title feat!: BREAKING CHANGE: update plugin contract add UploadResources feat: update plugin contract add UploadResources Feb 10, 2026
@matthiasbruns matthiasbruns marked this pull request as ready for review February 10, 2026 08:45
@matthiasbruns matthiasbruns requested a review from a team as a code owner February 10, 2026 08:45
Comment thread bindings/go/plugin/manager/registries/resource/contract.go Outdated
Comment thread bindings/go/plugin/manager/registries/resource/contract.go Outdated
Comment thread bindings/go/plugin/manager/registries/resource/registry_test.go
Comment thread bindings/go/plugin/go.mod Outdated
matthiasbruns and others added 4 commits February 10, 2026 10:01
Co-authored-by: Fabian Burth <fabian.burth@sap.com>
Signed-off-by: Matthias Bruns <github@matthiasbruns.com>
Co-authored-by: Fabian Burth <fabian.burth@sap.com>
Signed-off-by: Matthias Bruns <github@matthiasbruns.com>
On-behalf-of: SAP <matthias.bruns@sap.com>
Signed-off-by: Matthias Bruns <git@matthiasbruns.com>
On-behalf-of: SAP <matthias.bruns@sap.com>
Signed-off-by: Matthias Bruns <git@matthiasbruns.com>
@matthiasbruns matthiasbruns force-pushed the feat/resource_plugin_with_credentials branch from 9d5830a to f0ea3f3 Compare February 10, 2026 09:18
On-behalf-of: SAP <matthias.bruns@sap.com>
Signed-off-by: Matthias Bruns <git@matthiasbruns.com>
@matthiasbruns matthiasbruns force-pushed the feat/resource_plugin_with_credentials branch from f0ea3f3 to 1036630 Compare February 10, 2026 09:19
Comment thread bindings/go/plugin/manager/registries/resource/registry_test.go Outdated
Comment thread bindings/go/plugin/manager/registries/resource/registry_test.go Outdated
Signed-off-by: Matthias Bruns <github@matthiasbruns.com>
Comment thread bindings/go/plugin/manager/registries/resource/registry.go Outdated
@matthiasbruns matthiasbruns force-pushed the feat/resource_plugin_with_credentials branch from 0affcfa to f775b55 Compare February 10, 2026 13:07
@matthiasbruns

matthiasbruns commented Feb 10, 2026

Copy link
Copy Markdown
Contributor Author

rolled back to f775b55 since fileconfig will bloat up the changed too much

open-component-model/ocm-project#878

@fabianburth fabianburth merged commit 0520500 into open-component-model:main Feb 10, 2026
29 checks passed
@matthiasbruns matthiasbruns deleted the feat/resource_plugin_with_credentials branch February 10, 2026 13:31
matthiasbruns added a commit that referenced this pull request Feb 13, 2026
<!-- markdownlint-disable MD041 -->
#### What this PR does / why we need it
This PR ties all the changes related to
open-component-model/ocm-project#796 together
in the cli package and implement oci transfer with tests.
It also adds two new flags, which were taken from old ocm
https://ocm.software/docs/reference/ocm-cli/transfer/componentversions/

- `FlagCopyResources      = "copy-resources"`

in addition, I've added an integration test, that:
- creates two oci registries
- uploads one artifact to the first registry
- creates a cv pointing to the artifact
- calls:

```go
transferCMD.SetArgs([]string{
		"transfer",
		"component-version",
		sourceRef,
		targetRef,
		"--config", cfgPath,
		"--copy-resources", // required, otherwise we wouldn't transfer oci artifacts
	})
```
- verifies, that the oci artifact is in the 2nd registry

#### Which issue(s) this PR fixes
Contributes:
open-component-model/ocm-project#796

Split PRs:
- #1730
- #1751
- #1736
- #1727
- #1718
- #1717

---------

Signed-off-by: Matthias Bruns <git@matthiasbruns.com>
Signed-off-by: Matthias Bruns <github@matthiasbruns.com>
Signed-off-by: Fabian Burth <fabian.burth@sap.com>
Co-authored-by: Fabian Burth <fabian.burth@sap.com>
morri-son pushed a commit to morri-son/open-component-model that referenced this pull request Feb 16, 2026
<!-- markdownlint-disable MD041 -->
#### What this PR does / why we need it
This PR ties all the changes related to
open-component-model/ocm-project#796 together
in the cli package and implement oci transfer with tests.
It also adds two new flags, which were taken from old ocm
https://ocm.software/docs/reference/ocm-cli/transfer/componentversions/

- `FlagCopyResources      = "copy-resources"`

in addition, I've added an integration test, that:
- creates two oci registries
- uploads one artifact to the first registry
- creates a cv pointing to the artifact
- calls:

```go
transferCMD.SetArgs([]string{
		"transfer",
		"component-version",
		sourceRef,
		targetRef,
		"--config", cfgPath,
		"--copy-resources", // required, otherwise we wouldn't transfer oci artifacts
	})
```
- verifies, that the oci artifact is in the 2nd registry

#### Which issue(s) this PR fixes
Contributes:
open-component-model/ocm-project#796

Split PRs:
- open-component-model#1730
- open-component-model#1751
- open-component-model#1736
- open-component-model#1727
- open-component-model#1718
- open-component-model#1717

---------

Signed-off-by: Matthias Bruns <git@matthiasbruns.com>
Signed-off-by: Matthias Bruns <github@matthiasbruns.com>
Signed-off-by: Fabian Burth <fabian.burth@sap.com>
Co-authored-by: Fabian Burth <fabian.burth@sap.com>
morri-son pushed a commit to morri-son/open-component-model that referenced this pull request Feb 18, 2026
…l#1751)

<!-- markdownlint-disable MD041 -->
#### What this PR does / why we need it
Required plugin contract update for Resources to be able to upload
resources.
It also implements `repository.ResourceRepository` in
`ResourceRegistry`.
Additionally, the tests used a deprecated blob construction and was
updated to use the new prefered way

old:
`blob.NewDirectReadOnlyBlob`
new:
`inmemory.New`

Part of
open-component-model#1684

This PR aligns the plugin resource contract with the updated
`repository.ResourceRepository`

```go
// Repository defines the interface for storing and retrieving OCM resources
// independently of component versions from a Store Implementation
type Repository interface {
	// GetResourceCredentialConsumerIdentity resolves the identity of the given [descriptor.Resource] to use for credential resolution.
	GetResourceCredentialConsumerIdentity(ctx context.Context, resource *descriptor.Resource) (runtime.Identity, error)
	// UploadResource uploads a [descriptor.Resource] to the repository.
	// Returns the updated resource with repository-specific information.
	// The resource must be referenced in the component descriptor.
	// The credentials map must contain necessary authentication information to access the resource.
	UploadResource(ctx context.Context, res *descriptor.Resource, content blob.ReadOnlyBlob, credentials map[string]string) (*descriptor.Resource, error)
	// DownloadResource downloads and verifies the integrity of a [descriptor.Resource] from the repository.
	DownloadResource(ctx context.Context, res *descriptor.Resource, credentials map[string]string) (blob.ReadOnlyBlob, error)
}
```

#### Which issue(s) this PR fixes
Contributes:
open-component-model/ocm-project#796

---------

Signed-off-by: Matthias Bruns <git@matthiasbruns.com>
Signed-off-by: Matthias Bruns <github@matthiasbruns.com>
Co-authored-by: Fabian Burth <fabian.burth@sap.com>
Signed-off-by: Gerald Morrison (SAP) <gerald.morrison@sap.com>
morri-son pushed a commit to morri-son/open-component-model that referenced this pull request Feb 18, 2026
<!-- markdownlint-disable MD041 -->
#### What this PR does / why we need it
This PR ties all the changes related to
open-component-model/ocm-project#796 together
in the cli package and implement oci transfer with tests.
It also adds two new flags, which were taken from old ocm
https://ocm.software/docs/reference/ocm-cli/transfer/componentversions/

- `FlagCopyResources      = "copy-resources"`

in addition, I've added an integration test, that:
- creates two oci registries
- uploads one artifact to the first registry
- creates a cv pointing to the artifact
- calls:

```go
transferCMD.SetArgs([]string{
		"transfer",
		"component-version",
		sourceRef,
		targetRef,
		"--config", cfgPath,
		"--copy-resources", // required, otherwise we wouldn't transfer oci artifacts
	})
```
- verifies, that the oci artifact is in the 2nd registry

#### Which issue(s) this PR fixes
Contributes:
open-component-model/ocm-project#796

Split PRs:
- open-component-model#1730
- open-component-model#1751
- open-component-model#1736
- open-component-model#1727
- open-component-model#1718
- open-component-model#1717

---------

Signed-off-by: Matthias Bruns <git@matthiasbruns.com>
Signed-off-by: Matthias Bruns <github@matthiasbruns.com>
Signed-off-by: Fabian Burth <fabian.burth@sap.com>
Co-authored-by: Fabian Burth <fabian.burth@sap.com>
Signed-off-by: Gerald Morrison (SAP) <gerald.morrison@sap.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/feature new feature, enhancement, improvement, extension size/m Medium size/s Small

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants