-
Notifications
You must be signed in to change notification settings - Fork 645
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 #1197: Unable to build dockerFile without pushing it to docker server (DockerInDocker) #1297
Conversation
However, when I try to load image using this tarball. I get some error:
Is this desired behavior? |
bb83ad5
to
0f61b9c
Compare
Yes, I think so. It's really that this tar is picked up e.g. by another build mechansim like Kaniko to build the real image. However, I think it would be important to implement |
Actually thinking again, I think that a single argument should be sufficient:
wdyt ? |
@rhuss : okay, let me do the changes as you asked. |
Here is what I interpreted:
|
I hope we can detect if the option is given but without value. I'm not 100% if this is possible. Ideally we should also interprete the special values of So my suggestion would be:
@rohanKanojia wdyt ? I think this will nicely cover this feature with a single config option but still staying flexible and intuitive. |
cool 👍 , let me implement this in next update |
18bedb5
to
e648646
Compare
e648646
to
dc1a3ca
Compare
I hadn't noticed that the discussion had moved over here. Sorry for delay responding. I cloned this repo, built this branch and did some testing. So far things look good. I had to add I've updated one of my CI/CD pipelines to use this version of the plugin and then used Kaniko to create the Docker image in an environment that had no Docker daemon. |
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.
looks good to me with one minor change request.
* @return tarball for docker image | ||
* @throws MojoExecutionException in case any exception comes during building tarball | ||
*/ | ||
public File buildArchive(ImageConfiguration imageConfiguration, BuildContext buildContext, String buildArchiveOnlyFlagOrBuildArchiveLocation) |
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.
Can we make the last argument just a archivePath
and if not-null, store the archive there ? The caller should then prepare that parameter based on the options given. That way this method becomes much more reusable and decoupled from its actual, Maven specific usage.
log.info("%s: Created %s in %s", imageConfiguration.getDescription(), dockerArchive.getName(), EnvUtil.formatDurationTill(time)); | ||
|
||
// Copy created tarball to directory if specified | ||
if (buildArchiveOnlyFlagOrBuildArchiveLocation != null && !buildArchiveOnlyFlagOrBuildArchiveLocation.isEmpty()) { |
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.
Can we extract that to a method ? Also, remember, when its empty its the same as false
@@ -71,7 +77,10 @@ protected void buildAndTag(ServiceHub hub, ImageConfiguration imageConfig) | |||
ImagePullManager pullManager = getImagePullManager(determinePullPolicy(imageConfig.getBuildConfiguration()), autoPull); | |||
BuildService buildService = hub.getBuildService(); | |||
|
|||
buildService.buildImage(imageConfig, pullManager, buildContext); | |||
File buildArchiveFile = buildService.buildArchive(imageConfig, buildContext, buildArchiveOnly); |
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.
as mentioned below, the option should be already resolved here to the path (if any) for calling buildArchive
079a665
to
bdf6483
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.
Thanks a lot ! The last thing missing would be an update to the documentation, then we are ready to go.
bdf6483
to
a423664
Compare
…docker server (DockerInDocker)
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.
Thanks ! Some minor formatting issues, but I will fix that later.
let's merge it.
Fix #1197
with
docker.skip.build.image
flag we can skip pushing created docker archive to docker daemon.