Skip to content

fix(cli): transfer respect resolvers#1888

Merged
jakobmoellerdev merged 8 commits into
open-component-model:mainfrom
fabianburth:fix/transfer-respect-resolvers
Mar 3, 2026
Merged

fix(cli): transfer respect resolvers#1888
jakobmoellerdev merged 8 commits into
open-component-model:mainfrom
fabianburth:fix/transfer-respect-resolvers

Conversation

@fabianburth

@fabianburth fabianburth commented Mar 3, 2026

Copy link
Copy Markdown
Contributor

What this PR does / why we need it

So far, we were doing a prefetch of the components. The prefetch used the configured resolvers. Since those components are added to the environment of the TGD and not fetched via transformations, we did not run into issues here.

But the Generiererich hard coded against the from spec. This created issues for local blobs, as they now were trying to be fetched from the source repo instead of the correct repo configured by the resolvers.

Which issue(s) this PR fixes

Contributes to open-component-model/ocm-project#905

Testing

How to test the changes
Verification
  • I have tested the changes locally by running ocm

fabianburth added a commit that referenced this pull request Mar 3, 2026
<!-- markdownlint-disable MD041 -->
#### What this PR does / why we need it
Introduces a new method to retrieve the repository specification for a
given component version, enhancing the transfer operations.

#### Which issue(s) this PR fixes
<!--
Usage: `Fixes #<issue number>`, or `Fixes (paste link of issue)`.
-->
Contributes to
open-component-model/ocm-project#905

#### Testing

##### How to test the changes

<!--
Required files to test the changes:

.ocmconfig
```yaml
type: generic.config.ocm.software/v1
configurations:
  - type: credentials.config.ocm.software
    repositories:
      - repository:
          type: DockerConfig/v1
          dockerConfigFile: "~/.docker/config.json"
```

Commands that test the change:

```bash
ocm get cv xxx

ocm transfer xxx
```
-->

##### Verification

- [ ] I have tested the changes locally by running `ocm`

Manual tests will be performed as part of the follow up TGD adjustment
PR:
#1888

---------

Signed-off-by: Fabian Burth <fabian.burth@sap.com>
… local blob resources

This commit introduces integration tests for the transfer command
using resolvers, ensuring that component versions are correctly
transferred between repositories.

Signed-off-by: Fabian Burth <fabian.burth@sap.com>
- Added SourceRepository to discoveryValue for improved context.
- Updated processLocalBlob and processOCIArtifact to use discoveryValue.
- Refactored repository type handling for better clarity and error management.

Signed-off-by: Fabian Burth <fabian.burth@sap.com>
@fabianburth fabianburth force-pushed the fix/transfer-respect-resolvers branch from c38294f to 4da9003 Compare March 3, 2026 15:42
…r functions

Change ChooseAddType, ChooseGetLocalResourceType, and ChooseAddLocalResourceType
to return errors instead of panicking. Update all callers to handle the errors
properly. Also update ociUploadAsLocalResource to return an error tuple.

Signed-off-by: Fabian Burth <fabian.burth@sap.com>
Signed-off-by: Fabian Burth <fabian.burth@sap.com>
…ase of fallback resolver

Signed-off-by: Fabian Burth <fabian.burth@sap.com>
@fabianburth fabianburth force-pushed the fix/transfer-respect-resolvers branch from 4da9003 to cb33a27 Compare March 3, 2026 15:43
Comment thread cli/cmd/transfer/component-version/internal/discovery.go
Remove Ref from discoveryValue struct since the repository was incorrectly
inherited from parent. Child components may be stored in different repositories
as determined by the resolver's GetRepositorySpecificationForComponent.

Now uses simple component:version keys for graph traversal, with the resolver
independently determining the correct repository for each component.

Signed-off-by: Fabian Burth <fabian.burth@sap.com>
Signed-off-by: Fabian Burth <fabian.burth@sap.com>
@fabianburth

Copy link
Copy Markdown
Contributor Author

Didn't do a thorough self-review yet. But generally, this should be close to ready, also tested manually with both legacy and new resolvers.

@fabianburth fabianburth marked this pull request as ready for review March 3, 2026 17:20
@fabianburth fabianburth requested a review from a team as a code owner March 3, 2026 17:20
…ot exist

Signed-off-by: Fabian Burth <fabian.burth@sap.com>
@jakobmoellerdev jakobmoellerdev merged commit c52ee88 into open-component-model:main Mar 3, 2026
19 checks passed
@fabianburth fabianburth deleted the fix/transfer-respect-resolvers branch March 4, 2026 08:43
frewilhelm pushed a commit to frewilhelm/open-component-model that referenced this pull request Mar 12, 2026
<!-- markdownlint-disable MD041 -->
#### What this PR does / why we need it
So far, we were doing a prefetch of the components. The prefetch used
the configured resolvers. Since those components are added to the
environment of the TGD and not fetched via transformations, we did not
run into issues here.

But the Generiererich hard coded against the from spec. This created
issues for local blobs, as they now were trying to be fetched from the
source repo instead of the correct repo configured by the resolvers.

#### Which issue(s) this PR fixes
<!--
Usage: `Fixes #<issue number>`, or `Fixes (paste link of issue)`.
-->
Contributes to
open-component-model/ocm-project#905

#### Testing

##### How to test the changes

<!--
Required files to test the changes:

.ocmconfig
```yaml
type: generic.config.ocm.software/v1
configurations:
  - type: credentials.config.ocm.software
    repositories:
      - repository:
          type: DockerConfig/v1
          dockerConfigFile: "~/.docker/config.json"
```

Commands that test the change:

```bash
ocm get cv xxx

ocm transfer xxx
```
-->

##### Verification

- [x] I have tested the changes locally by running `ocm`

---------

Signed-off-by: Fabian Burth <fabian.burth@sap.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants