Fixes #957 Simplify configuration#969
Conversation
Codecov Report
@@ Coverage Diff @@
## master #969 +/- ##
===========================================
- Coverage 51.57% 51.4% -0.18%
Complexity 1232 1232
===========================================
Files 144 144
Lines 7251 7276 +25
Branches 981 985 +4
===========================================
Hits 3740 3740
- Misses 3195 3220 +25
Partials 316 316
|
rhuss
left a comment
There was a problem hiding this comment.
hey, looks good. Thanks !
Some minor change requests (see inline), otherwise looks good.
However, you should consider to add a documentation to the asciidoc, too and update the changelog.md
thanks ...
| } | ||
| for (ImageConfiguration imageConfig : getResolvedImages()) { | ||
| List<ImageConfiguration> resolvedImages = getResolvedImages(); | ||
| if(resolvedImages == null || resolvedImages.isEmpty()) { |
There was a problem hiding this comment.
resolvedImges can't be null otherwise the next for loop would fail with an NPE.
Actually I would either put this into an extra method which returns early in this case or put this into an if-else with the following loop.
| return minimalApiVersion; | ||
| } | ||
|
|
||
| public static ImageConfiguration getDefaultImageConfiguration(MavenProject project, String defaultImageName) { |
There was a problem hiding this comment.
Can we keep the dependency on Maven low ? actually I would keep the extraction of the default name from maven coordinates in the Mojos.
The reason is, that eventually, we might want to separate the Maven and non-Maven parts (see https://github.com/fabric8io/fabric8-build for more details of these plans).
| * @return directory containing the Dockerfile | ||
| */ | ||
| public static String getDockerFileDirectory() { | ||
| if(checkFileExists("./Dockerfile")) { |
There was a problem hiding this comment.
I would not rely on the current working directory (which might e.g. completely elsewhere in a multi-module project). Instead you ${project.baseDir} (or the MavenProject's equivalent) should be taken into account (which is the absolute path to the module base directory).
| */ | ||
| public static String getDockerFileDirectory() { | ||
| if(checkFileExists("./Dockerfile")) { | ||
| return new String("."); |
There was a problem hiding this comment.
same here: Best to always work with absolute directories, that will work everywhere. With relative directories this is always fragile and it really depends where this method is used.
| public static String getDockerFileDirectory() { | ||
| if(checkFileExists("./Dockerfile")) { | ||
| return new String("."); | ||
| } else if(checkFileExists("src/main/docker/Dockerfile")){ |
| if(checkFileExists("./Dockerfile")) { | ||
| return new String("."); | ||
| } else if(checkFileExists("src/main/docker/Dockerfile")){ | ||
| return new String("src/main/docker"); |
There was a problem hiding this comment.
what's the difference between new String("src/main/docker") and "src/main/docker" ?
sorry, but that's an oldtimer ;-) and does not make sense at all as String is always immutable. so you can always return the plain string.
+ When only a single image is build with Dockerfile, no need to provide too much parameters in configuration; build ImageConfiguration dynamically with the given defaults. + Updated Changelog.md and asciidoc with related changes
|
@rohanKanojia Thanks ! Looks good to me .... |
When only a single image is build with Dockerfile, no need to provide
too much parameters in configuration; build ImageConfiguration dynamically
with the given defaults.
#957