-
Notifications
You must be signed in to change notification settings - Fork 159
[POC] Some exploration base image puller and matcher #16417
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
base: master
Are you sure you want to change the base?
Conversation
Skipping CI for Draft Pull Request. |
Caution There are some errors in your PipelineRun template.
|
Images are ready for the commit at 52822a6. To use with deploy scripts, first |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #16417 +/- ##
=======================================
Coverage 49.07% 49.08%
=======================================
Files 2640 2640
Lines 195603 195603
=======================================
+ Hits 95999 96002 +3
+ Misses 92095 92093 -2
+ Partials 7509 7508 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Pull Request Overview
This PR introduces a proof-of-concept (POC) tool for base image detection that infers an image's base by matching the target's layer digest prefix against a set of candidate base images. The tool operates without pulling image layers, instead relying on manifest inspection for efficient analysis.
Key changes:
- Implementation of a registry client for container image inspection
- Base image detection algorithm using layer digest prefix matching
- JSON-based caching system for registry metadata
- CLI tool with support for both explicit base references and repository exploration
Reviewed Changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
registry/registry.go | Registry client implementation for image inspection and tag listing |
main.go | Main CLI application with base image detection logic and semver-based tag sorting |
jsoncache/jsoncache.go | JSON file cache for storing registry inspection results |
go.mod | Go module dependencies including container registry libraries |
README.md | Documentation explaining the POC concept, usage, and limitations |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.
} | ||
|
||
func (rc *Client) authID(authfile string) string { | ||
h := sha1.New() |
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.
SHA-1 is cryptographically weak and should not be used for security purposes. Consider using SHA-256 or another secure hash function from the crypto/sha256 package.
h := sha1.New() | |
h := sha256.New() |
Copilot uses AI. Check for mistakes.
func (c *JSONCache) pathFor(key string) string { | ||
// slug + digest to keep filenames short & safe | ||
slug := regexp.MustCompile(`[^a-zA-Z0-9]+`).ReplaceAllString(strings.ToLower(key), "") | ||
sum := sha1.Sum([]byte(key)) |
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.
SHA-1 is cryptographically weak and should not be used. Consider using SHA-256 or another secure hash function from the crypto/sha256 package.
sum := sha1.Sum([]byte(key)) | |
sum := sha256.Sum256([]byte(key)) |
Copilot uses AI. Check for mistakes.
Description
A ad-hoc tool to explore the concept and idea behind the plans for base image detection. See README for further details.
User-facing documentation
Testing and quality
Automated testing
How I validated my change
Example on how this works: