Skip to content

fix: register oci type instead of AnyConsumerIdentityType#1890

Merged
frewilhelm merged 15 commits into
open-component-model:mainfrom
frewilhelm:registry-docker-credential-type
Mar 16, 2026
Merged

fix: register oci type instead of AnyConsumerIdentityType#1890
frewilhelm merged 15 commits into
open-component-model:mainfrom
frewilhelm:registry-docker-credential-type

Conversation

@frewilhelm

@frewilhelm frewilhelm commented Mar 3, 2026

Copy link
Copy Markdown
Contributor

What this PR does / why we need it

Currently, the OCICredentialRepository is registered with the AnyConsumerIdentityType. As a result, any credential identity * would be matched against the OCICredentialRepository. However, the OCICredentialRepository can only handle credentials of type DockerConfig which requires certain fields, e.g. hostname.

This PR changes the registration of the OCICredentialRepository with AnyConsumerIdentityType to v1.Type which results in OCIRepository.

Which issue(s) this PR fixes

Fixes open-component-model/ocm-project#786

Testing

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

Summary by CodeRabbit

  • Refactor
    • Modernized OCI credentials identity type infrastructure across controller components and test suites. Updated internal credential repository plugin registration mechanisms to use versioned identity specifications instead of generic consumer identity types. Changes enhance consistency, maintainability, and alignment with OCI credential handling standards, improving overall system architecture.

@github-actions github-actions Bot added the size/s Small label Mar 3, 2026
@frewilhelm frewilhelm changed the title register oci type instead of docker fix: register oci type instead of docker Mar 3, 2026
@github-actions github-actions Bot added the kind/bugfix Bug label Mar 3, 2026
@frewilhelm frewilhelm changed the title fix: register oci type instead of docker fix: register oci type instead of AnyConsumerIdentityType Mar 3, 2026
@coderabbitai

coderabbitai Bot commented Mar 12, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 83b008e6-4721-43c4-8148-40a4b9ba5052

📥 Commits

Reviewing files that changed from the base of the PR and between 2a74516 and e3d5087.

📒 Files selected for processing (5)
  • cli/internal/plugin/builtin/credentials/oci/plugin.go
  • kubernetes/controller/cmd/main.go
  • kubernetes/controller/internal/controller/component/suite_test.go
  • kubernetes/controller/internal/controller/deployer/suite_test.go
  • kubernetes/controller/internal/controller/resource/suite_test.go
🚧 Files skipped from review as they are similar to previous changes (3)
  • kubernetes/controller/internal/controller/resource/suite_test.go
  • kubernetes/controller/internal/controller/deployer/suite_test.go
  • kubernetes/controller/internal/controller/component/suite_test.go

📝 Walkthrough

Walkthrough

The changes migrate OCI credential repository registrations from using a generic AnyConsumerIdentityType to the specific versioned v1.Type identity type across plugin code and test configurations. Import statements are updated accordingly to reference the versioned identity type.

Changes

Cohort / File(s) Summary
OCI Plugin & Controller Registration
cli/internal/plugin/builtin/credentials/oci/plugin.go, kubernetes/controller/cmd/main.go
Updated imports and credential repository registration to use v1.Type instead of credentials.AnyConsumerIdentityType for OCI identity type specificity.
Test Suite Configuration
kubernetes/controller/internal/controller/.../suite_test.go
Aligned test setup across multiple test suites (component, deployer, resource) to register OCI credential repositories with the specific v1.Type instead of the generic identity type.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • jakobmoellerdev

Poem

🐰 A rabbit hops with glee so bright,
From any-type to v1's light!
No more guessing, specific and true,
OCI credentials, refined anew!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: registering the OCI type instead of AnyConsumerIdentityType across multiple files.
Linked Issues check ✅ Passed The code changes successfully implement the primary objective from issue #786: replacing AnyConsumerIdentityType registration with v1.Type (OCI-specific identity type) across CLI and Kubernetes controller components.
Out of Scope Changes check ✅ Passed All changes are directly related to the PR objective. Modifications consistently replace credentials.AnyConsumerIdentityType with v1.Type imports and registrations across five files.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
📝 Coding Plan
  • Generate coding plan for human review comments

Comment @coderabbitai help to get the list of available commands and usage tips.

@frewilhelm

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Mar 12, 2026

Copy link
Copy Markdown
Contributor
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@frewilhelm frewilhelm force-pushed the registry-docker-credential-type branch from e71bc60 to 264686b Compare March 12, 2026 15:56
@github-actions github-actions Bot added component/github-actions Changes on GitHub Actions or within `.github/` directory area/documentation Documentation related size/xl Extra large labels Mar 12, 2026
@frewilhelm frewilhelm force-pushed the registry-docker-credential-type branch from 264686b to 8244b6b Compare March 12, 2026 15:59
Signed-off-by: Frederic Wilhelm <frederic.wilhelm@sap.com>
@frewilhelm frewilhelm force-pushed the registry-docker-credential-type branch from 8244b6b to 22925c5 Compare March 12, 2026 16:01
Signed-off-by: Frederic Wilhelm <frederic.wilhelm@sap.com>
@frewilhelm frewilhelm force-pushed the registry-docker-credential-type branch from 22925c5 to 48327f2 Compare March 12, 2026 16:06
@frewilhelm

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Mar 12, 2026

Copy link
Copy Markdown
Contributor
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Signed-off-by: Frederic Wilhelm <frederic.wilhelm@sap.com>
@frewilhelm frewilhelm force-pushed the registry-docker-credential-type branch from 0a829ef to aabdd7b Compare March 13, 2026 09:13
frewilhelm added a commit that referenced this pull request Mar 13, 2026
We removed the registration of `AnyConsumerIdentity` for the OCI
Credential plugin in #1890. While working on it, we noticed that, now,
we error out when no repository plugin is found for a consumer type,
e.g. `HelmChartRepository`, because we do not have a fallback repository
anymore.

This PR introduces a typed error to handle this. By returning
`ErrNoRepositoryPluginFound` the caller can decide what to do with it.
In our case, we do want to append the error `ErrNoIndirectCredentials`
when resolving the credential indirectly, so the caller can, for
example, just log the error and continue.

> // TODO(@frewilhelm): Discuss if we want to introduce another API
instead, e.g. IsRegistered(typed runtime.Typed)

Currently, we just introduced a typed error. However, we should discuss
if we want to add an API, e.g. `IsRegistered(typed runtime.Typed)`
instead to give potential other users the possibility to use the
functionality

---

This is a required PR for #1890 because we need to update the
`credential` module to make it work. You can take a look at the PR to
see how the error is used in
[`bindings/go/plugin/manager/registries/credentialrepository/graph_integration.go`](https://github.com/open-component-model/open-component-model/pull/1890/changes#diff-ea6f3328552c9ace91b8a2a703762023cbfd7e4d068c19dcbea29ae2c0624e56)

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
* Added a new error signal to surface a specific "no repository plugin"
condition.

* **Bug Fixes**
* Improved fallback resolution logic to return clearer, combined error
information when a repository plugin is not found, leading to more
precise error reporting during credential resolution.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: Frederic Wilhelm <frederic.wilhelm@sap.com>
Signed-off-by: Frederic Wilhelm <frederic.wilhelm@sap.com>
Signed-off-by: Frederic Wilhelm <frederic.wilhelm@sap.com>
@frewilhelm

Copy link
Copy Markdown
Contributor Author

Previously failing integration tests were fixed with #1967 and #1970 (notice that we removed the typed error again in the second PR but kept returning the ErrNoIndirectCredentials)

@frewilhelm frewilhelm marked this pull request as ready for review March 16, 2026 07:18
@frewilhelm frewilhelm requested a review from a team as a code owner March 16, 2026 07:18
@frewilhelm

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Mar 16, 2026

Copy link
Copy Markdown
Contributor
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@frewilhelm frewilhelm enabled auto-merge (squash) March 16, 2026 11:41
@frewilhelm frewilhelm merged commit 4749d4f into open-component-model:main Mar 16, 2026
43 of 47 checks passed
@frewilhelm frewilhelm deleted the registry-docker-credential-type branch March 30, 2026 11:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/documentation Documentation related component/github-actions Changes on GitHub Actions or within `.github/` directory kind/bugfix Bug size/s Small size/xl Extra large

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Register docker credential repository for its corresponding consumer identity type instead of for AnyConsumerIdentityType

3 participants