Skip to content

Add Docker certs.d support to crane#2319

Open
Haihan-Jiang wants to merge 1 commit into
google:mainfrom
Haihan-Jiang:codex/go-containerregistry-docker-certs
Open

Add Docker certs.d support to crane#2319
Haihan-Jiang wants to merge 1 commit into
google:mainfrom
Haihan-Jiang:codex/go-containerregistry-docker-certs

Conversation

@Haihan-Jiang

Copy link
Copy Markdown
Contributor

Summary

  • add a crane transport wrapper that loads Docker-style per-registry certificate directories
  • support registry CA files (*.crt) and client certificate/key pairs (*.cert/*.key)
  • enable the wrapper for crane while keeping the existing transport headers, warnings, and insecure handling intact

Details

Docker supports custom registry certificates under certs.d/<registry-host>/. This teaches crane to look up the request registry host, clone the base transport for that host, and apply matching certs only to that registry. Missing cert directories are ignored, while incomplete client certificate pairs return an early configuration error.

Updates #211.

Testing

  • go test ./cmd/crane/cmd
  • go test ./cmd/crane/... ./pkg/crane/...
  • go test ./pkg/v1/remote/transport
  • PATH="$PATH:$(go env GOPATH)/bin" ./hack/presubmit.sh

@Haihan-Jiang
Haihan-Jiang marked this pull request as ready for review May 24, 2026 10:53
@Haihan-Jiang

Haihan-Jiang commented May 30, 2026

Copy link
Copy Markdown
Contributor Author

This is still ready for review from my side. It adds Docker certs.d support to crane while keeping the existing keychain path intact; could someone take a look when convenient?

@codecov-commenter

codecov-commenter commented Jun 17, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 53.33333% with 42 lines in your changes missing coverage. Please review.
✅ Project coverage is 56.89%. Comparing base (31df54c) to head (83fd770).
⚠️ Report is 19 commits behind head on main.

Files with missing lines Patch % Lines
cmd/crane/cmd/docker_certs.go 53.93% 25 Missing and 16 partials ⚠️
cmd/crane/cmd/root.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2319      +/-   ##
==========================================
- Coverage   56.91%   56.89%   -0.03%     
==========================================
  Files         165      166       +1     
  Lines       11362    11451      +89     
==========================================
+ Hits         6467     6515      +48     
- Misses       4134     4159      +25     
- Partials      761      777      +16     

☔ View full report in Codecov by Harness.
📢 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.

}

func loadDockerCertsDir(directory string, tlsConfig *tls.Config) error {
files, err := os.ReadDir(directory)
}
tlsConfig.RootCAs = systemPool
}
data, err := os.ReadFile(filepath.Join(directory, f.Name()))
@Subserial

Subserial commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Hi, just leaving a comment to say that I am still reviewing all of your PRs, it's just taking a bit of time to process new feature work. A bit late but I've approved running tests on each one.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants