Skip to content

Conversation

@TerryHowe
Copy link
Member

@TerryHowe TerryHowe commented Sep 13, 2025

Add support for registries.conf. This is not a full implementation it'll be a follow-up PR with more features for the file. This does contain basic support though.

Based on https://github.com/containers/image/blob/main/docs/containers-registries.conf.5.md
More detail https://man.archlinux.org/man/containers-registries.conf.5.en

This PR depends on #1006

Closes: #918
Closes: #1058

@codecov
Copy link

codecov bot commented Sep 13, 2025

Codecov Report

❌ Patch coverage is 80.64516% with 30 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.44%. Comparing base (0324380) to head (95e31f4).

Files with missing lines Patch % Lines
...gistry/remote/internal/configuration/registries.go 80.64% 17 Missing and 13 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1008      +/-   ##
==========================================
- Coverage   82.54%   82.44%   -0.11%     
==========================================
  Files          64       65       +1     
  Lines        4779     4934     +155     
==========================================
+ Hits         3945     4068     +123     
- Misses        510      529      +19     
- Partials      324      337      +13     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Wwwsylvia Wwwsylvia requested a review from Copilot October 10, 2025 11:15
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements support for the registries.conf file format, extending the credentials package to handle both Docker config.json and containers registries.conf configurations. It introduces a Config interface to abstract different configuration formats and reorganizes the code structure for better modularity.

Key changes:

  • Introduces registriesConf type that implements TOML-based configuration handling
  • Adds a Config interface to abstract different configuration formats
  • Reorganizes the credentials package structure by moving types and splitting functionality
  • Adds the NewStoreFromRegistriesConf function for creating stores from registries.conf files

Reviewed Changes

Copilot reviewed 38 out of 40 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
registry/remote/credentials/registries_conf.go Implements TOML-based registries.conf parsing and management
registry/remote/credentials/config.go Defines the Config interface for abstracting configuration formats
registry/remote/credentials/auth_config.go Extracted auth configuration handling from config_json.go
registry/remote/credentials/credential.go Moved credential types and functions from auth package
registry/remote/credentials/store.go Updated to use Config interface and added registries.conf support
registry/remote/credentials/config_json.go Refactored to implement Config interface
Multiple test files Updated imports and type references after package reorganization

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@Wwwsylvia
Copy link
Member

Looks like this depends on #1006

@TerryHowe
Copy link
Member Author

Looks like this depends on #1006

Yes. I'm going to convert this to a draft for now.

@TerryHowe TerryHowe marked this pull request as draft November 8, 2025 12:36
@TerryHowe TerryHowe added the v3 Things belongs to version 3.x label Nov 17, 2025
@TerryHowe TerryHowe added this to the v3.0.0 milestone Nov 17, 2025
@TerryHowe TerryHowe force-pushed the feature-add-registries-conf branch from 43d3a29 to d118dd9 Compare November 24, 2025 02:08
@TerryHowe TerryHowe force-pushed the feature-add-registries-conf branch 2 times, most recently from f25284d to 434bb45 Compare December 26, 2025 16:44
@TerryHowe
Copy link
Member Author

Rebased the commit on main instead of the credential change.

@TerryHowe TerryHowe marked this pull request as ready for review December 26, 2025 16:46
@TerryHowe TerryHowe requested a review from sabre1041 as a code owner December 26, 2025 16:46
@TerryHowe TerryHowe force-pushed the feature-add-registries-conf branch from 434bb45 to af65a10 Compare January 1, 2026 21:55
@TerryHowe
Copy link
Member Author

Just moved the directory to internal and rebased

Copy link
Contributor

@sabre1041 sabre1041 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good. Question regarding the TOML library implementation

go.mod Outdated
require (
github.com/opencontainers/go-digest v1.0.0
github.com/opencontainers/image-spec v1.1.1
github.com/pelletier/go-toml/v2 v2.2.4
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any thoughts about swapping the TOML parsing libraries to github.com/BurntSushi/toml? This is the library that is used by the container tools as well as Helm

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@TerryHowe TerryHowe force-pushed the feature-add-registries-conf branch from af65a10 to 95e31f4 Compare January 6, 2026 11:45
Copy link
Contributor

@sabre1041 sabre1041 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@shizhMSFT shizhMSFT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is containers-registries.conf cross-platform? If not, you need to document the OS limitation.

go 1.24.0

require (
github.com/BurntSushi/toml v1.4.0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The latest version is v1.6.0.

limitations under the License.
*/

package configuration
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is better to be config instead of configuration.

)

// RegistriesConfig represents a registries.conf configuration file.
// Reference: https://github.com/containers/image/blob/main/docs/containers-registries.conf.5.md
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use link from tags or commits and never with main branch as the link may easily break.

limitations under the License.
*/

package configuration
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the purpose of having this package in internal? Should it be registry/remote/config?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v3 Things belongs to version 3.x

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for registries.conf.d Support for containers-registries.conf based Container Registry Configuration

5 participants