-
Notifications
You must be signed in to change notification settings - Fork 97
feat: modularize patching logic #1228
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
feat: modularize patching logic #1228
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #1228 +/- ##
==========================================
+ Coverage 42.65% 42.86% +0.21%
==========================================
Files 24 35 +11
Lines 3946 4122 +176
==========================================
+ Hits 1683 1767 +84
- Misses 2135 2224 +89
- Partials 128 131 +3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
b4acadb
to
323400f
Compare
144a58d
to
e6d155a
Compare
e6d155a
to
aa818d9
Compare
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 modularizes the patching logic by breaking down the monolithic patch.go
file into separate, focused modules and introduces a standardized Options
struct for consistent parameter passing across the copacetic system.
Key changes:
- Splits large
patch.go
into focused modules (single.go, multi.go, platform.go, etc.) - Introduces
types.Options
struct to standardize copacetic configuration - Creates
common
package with shared utilities for OS detection, progress display, and platform handling
Reviewed Changes
Copilot reviewed 19 out of 19 changed files in this pull request and generated 3 comments.
Show a summary per file
File | Description |
---|---|
pkg/types/options.go | Introduces standardized Options struct for copacetic configuration |
pkg/patch/single.go | Handles single-architecture image patching logic |
pkg/patch/multi.go | Manages multi-platform image patching workflow |
pkg/patch/platform.go | Contains platform-specific utilities and filtering logic |
pkg/patch/core.go | Provides core patching functionality for reuse by different frontends |
pkg/patch/manifest.go | Handles multi-platform manifest creation and management |
pkg/patch/build.go | Manages build configuration and source policy validation |
pkg/patch/loader.go | Contains image loader detection logic |
pkg/patch/patch.go | Refactored main patch orchestration with simplified interface |
pkg/patch/cmd.go | Updates command interface to use new Options struct |
pkg/patch/patch_test.go | Updates tests to work with new modular structure |
pkg/common/*.go | New shared utilities for OS detection, progress display, and platform handling |
Comments suppressed due to low confidence (2)
pkg/patch/platform.go:121
- The
fmt.Sprintf
call inside the log statement creates unnecessary string formatting overhead. Consider usingplatforms.Format(*it.PatchedDesc.Platform)
or constructing the string directly in the log call.
return nil, fmt.Errorf("error getting manifest: %w", err)
pkg/patch/cmd.go:21
- [nitpick] The field name was changed from
reportFile
toreport
but this may be confusing since the field can represent both a file path or directory path. ConsiderreportPath
for clarity.
report string
aa818d9
to
c91b256
Compare
Signed-off-by: robert-cronin <robert.owen.cronin@gmail.com>
c91b256
to
5e6d3f3
Compare
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.
LGTM
patch.go
logic out into separate files in preparation for buildkit frontend and generate commandOptions
to standardize copacetic optionsCloses #1227