-
Notifications
You must be signed in to change notification settings - Fork 528
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
refactor (jkube-kit/build) : Move buildArgs related logic to a new class BuildArgResolverUtil #2994
refactor (jkube-kit/build) : Move buildArgs related logic to a new class BuildArgResolverUtil #2994
Conversation
Eclipse JKube CI ReportStarted new GH workflow run for #2994 (2024-04-30T12:52:38Z) ⚙️ JKube E2E Tests (8894491613)
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2994 +/- ##
=============================================
+ Coverage 59.36% 70.85% +11.49%
- Complexity 4586 5080 +494
=============================================
Files 500 490 -10
Lines 21211 19571 -1640
Branches 2830 2525 -305
=============================================
+ Hits 12591 13867 +1276
+ Misses 7370 4478 -2892
+ Partials 1250 1226 -24 ☔ View full report in Codecov by Sentry. |
public static Map<String, String> mergeBuildArgs(ImageConfiguration imageConfig, JKubeConfiguration configuration) { | ||
return prepareBuildArgs(addBuildArgs(configuration), imageConfig.getBuildConfiguration()); | ||
} |
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.
Could we use this PR to provide some sort of order and orchestration for this method instead of just chaining methods.
It'd be nice if the method would show how the args are computed and populated based on their source. This would also show how the precedence works.
final Map<String, String> args = new HashMap<>();
// Least precedence args added to the map
// Next args added to the map, overriding any previous entries
// ...
return args;
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.
While addressing this, I noticed that we're using Guava's com.google.common.collect.ImmutableMap
that throws exception when colliding keys are added.
Shall I remove its usage? At the moment, we are throwing exception on collision.
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.
So at the moment it's not possible to override args? that's weird.
We should definitely remove Guava.
If the current behavior is that override is not possible, we can preserve it. We should also create a new issue to see if we want to change this. IMO users my want to be able to provide one-off overrides, so maybe a warning instead of an exception is better.
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.
I've created #3000 for this task.
a34d5da
to
06017bf
Compare
…ass BuildArgResolverUtil Related to eclipse-jkube#2904 It's better to move code for resolving build args from different sources to a dedicated class. It doesn't look like BuildService is the right place for this. This way we can also use it from other BuildServices of other build strategies. Signed-off-by: Rohan Kumar <[email protected]>
06017bf
to
e4b5075
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.
Simplify logic to allow for easier future developments and improvements. Signed-off-by: Marc Nuri <[email protected]>
af39006
to
bb50a22
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, thx!
Quality Gate passedIssues Measures |
Description
Related to #2904
It's better to move code for resolving build args from different sources to a dedicated class. It doesn't look like BuildService is the right place for this. This way we can also use it from other BuildServices of other build strategies.
This PR just moves BuildArg related logic to a new utility class. There is one additional test for adding build args from docker proxy config.
Type of change
test, version modification, documentation, etc.)
Checklist