Skip to content
This repository has been archived by the owner on Mar 31, 2022. It is now read-only.

Adding support for exporting an image as a tar archive. #330

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Smiche
Copy link

@Smiche Smiche commented Oct 26, 2019

Simple draft of having the option to export the built image as a tar archive. This feature was present in the older docker-maven-plugin. Code was just borrowed from there.

Copy link
Member

@mattnworb mattnworb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for the PR! Makes sense to me overall, but I have a concern about the error-handling.

Comment on lines +169 to +177
} catch (IOException e) {
log.warn("IOException thrown while trying to write the image archive.");
} catch (DockerException e) {
log.warn("Docker threw an exception while trying to write the image archive: "
+ e.getMessage());
} catch (InterruptedException e) {
log.warn("InterruptedException thrown while trying to write the image archive.");
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm curious about the error handling here. It seems like if an exception was thrown by dockerClient.save() (or the file copy) then the plugin execution will continue, and probably print a BUILD SUCCESS message from Maven, but with a warning message that saving the image archive to a tarball failed.

How about failing the build in those cases? I'd assume that if someone configured the build to save the image archive to a file, they'd want the build to fail if that action failed.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes perfect sense to me. I already found one case where an exception occurs: running the basic integration test, The image has scratch as a base so the tar archive is 0 bytes and an exception is thrown.

Do you think an extra integration test is needed to test the archive export
as well?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think an extra integration test is needed to test the archive export
as well?

I think that would be nice to have but not necessary

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants