use of org.eclipse.jkube.kit.common.archive.ArchiveCompression in project jkube by eclipse.
the class AssemblyManager method createAssemblyArchive.
private void createAssemblyArchive(AssemblyConfiguration assemblyConfig, JKubeConfiguration params, BuildDirs buildDirs, ArchiveCompression compression, Map<Assembly, List<AssemblyFileEntry>> layers) throws IOException {
if (layers.isEmpty()) {
return;
}
AssemblyConfigurationSource source = new AssemblyConfigurationSource(params, buildDirs, assemblyConfig);
JKubeBuildTarArchiver jkubeTarArchiver = new JKubeBuildTarArchiver();
AssemblyMode buildMode = assemblyConfig.getMode();
try {
layers.values().stream().flatMap(List::stream).filter(afe -> StringUtils.isNotBlank(afe.getFileMode())).forEach(jkubeTarArchiver::setFileMode);
jkubeTarArchiver.createArchive(source.getOutputDirectory(), buildDirs, compression);
} catch (IOException e) {
String error = "Failed to create assembly for docker image " + " (with mode '" + buildMode + "'): " + e.getMessage() + ".";
if (params.getProject().getArtifact() == null) {
error += " If you include the build artifact please ensure that you have " + "built the artifact before with 'mvn package' (should be available in the target/ dir). " + "Please see the documentation (section \"Assembly\") for more information.";
}
throw new IOException(error, e);
}
}
Aggregations