-
Notifications
You must be signed in to change notification settings - Fork 559
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: mimic oci-layout in diskblobhandler #1810
Conversation
func (m *diskHandler) Stat(_ context.Context, _ string, h v1.Hash) (int64, error) { | ||
fi, err := os.Stat(filepath.Join(m.dir, h.String())) | ||
fi, err := os.Stat(m.blobHashPath(h)) |
Check failure
Code scanning / CodeQL
Uncontrolled data used in path expression
@@ -40,7 +44,7 @@ | |||
return fi.Size(), nil | |||
} | |||
func (m *diskHandler) Get(_ context.Context, _ string, h v1.Hash) (io.ReadCloser, error) { | |||
return os.Open(filepath.Join(m.dir, h.String())) | |||
return os.Open(m.blobHashPath(h)) |
Check failure
Code scanning / CodeQL
Uncontrolled data used in path expression
@@ -57,9 +61,11 @@ | |||
}(); err != nil { | |||
return err | |||
} | |||
|
|||
return os.Rename(f.Name(), filepath.Join(m.dir, h.String())) | |||
if err := os.MkdirAll(filepath.Join(m.dir, h.Algorithm), os.ModePerm); err != nil { |
Check failure
Code scanning / CodeQL
Uncontrolled data used in path expression
if err := os.MkdirAll(filepath.Join(m.dir, h.Algorithm), os.ModePerm); err != nil { | ||
return err | ||
} | ||
return os.Rename(f.Name(), m.blobHashPath(h)) |
Check failure
Code scanning / CodeQL
Uncontrolled data used in path expression
} | ||
func (m *diskHandler) Delete(_ context.Context, _ string, h v1.Hash) error { | ||
return os.Remove(filepath.Join(m.dir, h.String())) | ||
return os.Remove(m.blobHashPath(h)) |
Check failure
Code scanning / CodeQL
Uncontrolled data used in path expression
Codecov Report
@@ Coverage Diff @@
## main #1810 +/- ##
==========================================
- Coverage 71.88% 71.87% -0.02%
==========================================
Files 122 122
Lines 9832 9837 +5
==========================================
+ Hits 7068 7070 +2
- Misses 2081 2083 +2
- Partials 683 684 +1
|
@imjasonh @jonjohnsonjr friendly ping... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry I'd missed this, thanks for pinging again.
….17.0 (#35) [](https://renovatebot.com) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [github.com/google/go-containerregistry](https://togithub.com/google/go-containerregistry) | require | minor | `v0.16.1` -> `v0.17.0` | --- ### Release Notes <details> <summary>google/go-containerregistry (github.com/google/go-containerregistry)</summary> ### [`v0.17.0`](https://togithub.com/google/go-containerregistry/releases/tag/v0.17.0) [Compare Source](https://togithub.com/google/go-containerregistry/compare/v0.16.1...v0.17.0) #### What's Changed - 🦅 Validate index architectures match children 🦅 by [@​jonjohnsonjr](https://togithub.com/jonjohnsonjr) in [https://github.com/google/go-containerregistry/pull/1776](https://togithub.com/google/go-containerregistry/pull/1776) - Set Content-Length for blob uploads by [@​jonjohnsonjr](https://togithub.com/jonjohnsonjr) in [https://github.com/google/go-containerregistry/pull/1781](https://togithub.com/google/go-containerregistry/pull/1781) - Don't wrap DefaultKeychain with refreshes by [@​jonjohnsonjr](https://togithub.com/jonjohnsonjr) in [https://github.com/google/go-containerregistry/pull/1791](https://togithub.com/google/go-containerregistry/pull/1791) - Build releases with Go 1.21 by [@​imjasonh](https://togithub.com/imjasonh) in [https://github.com/google/go-containerregistry/pull/1840](https://togithub.com/google/go-containerregistry/pull/1840) - fix: mimic oci-layout in diskblobhandler by [@​thesayyn](https://togithub.com/thesayyn) in [https://github.com/google/go-containerregistry/pull/1810](https://togithub.com/google/go-containerregistry/pull/1810) - tag: add command explanation to the long help by [@​abitrolly](https://togithub.com/abitrolly) in [https://github.com/google/go-containerregistry/pull/1843](https://togithub.com/google/go-containerregistry/pull/1843) - feat: implement gc command by [@​thesayyn](https://togithub.com/thesayyn) in [https://github.com/google/go-containerregistry/pull/1811](https://togithub.com/google/go-containerregistry/pull/1811) - feat: allow port and disk path to be overriden by [@​thesayyn](https://togithub.com/thesayyn) in [https://github.com/google/go-containerregistry/pull/1848](https://togithub.com/google/go-containerregistry/pull/1848) **Full Changelog**: google/go-containerregistry@v0.16.1...v0.17.0 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/crossplane-contrib/xp-testing). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy44Ny4yIiwidXBkYXRlZEluVmVyIjoiMzcuODcuMiIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==-->
this change makes blob disk implementation mimic oci-layout for storing blobs. This will speed up the pushing of
oci-layout images on disk to the registry by providing the oci-layout image as the storage directory.
Cross-ref: bazel-contrib/rules_oci#365