@Test public void testCopyInvalidVerifyGivenDockerfile(@Injectable final KitLogger logger) throws IOException { BuildConfiguration buildConfig = createBuildConfig(); assemblyManager.verifyGivenDockerfile( new File(getClass().getResource("/docker/Dockerfile_assembly_verify_copy_invalid.test").getPath()), buildConfig, createInterpolator(buildConfig), logger); new Verifications() {{ logger.warn(anyString, (Object []) any); times = 1; }}; }
void verifyGivenDockerfile(File dockerFile, BuildConfiguration buildConfig, FixedStringSearchInterpolator interpolator, KitLogger log) throws IOException { AssemblyConfiguration assemblyConfig = buildConfig.getAssemblyConfiguration(); if (assemblyConfig == null) { return; } String name = assemblyConfig.getName(); for (String keyword : new String[] { "ADD", "COPY" }) { List<String[]> lines = InterPolatorHelper.extractLines(dockerFile, keyword, interpolator); for (String[] line : lines) { if (!line[0].startsWith("#")) { int i; for (i = 1; i < line.length; i++) { String component = line[i]; if (!component.startsWith("--")) { break; } } if (i < line.length && line[i].contains(name)) { return; } } } } log.warn("Dockerfile %s does not contain an ADD or COPY directive to include assembly created at %s. Ignoring assembly.", dockerFile.getPath(), name); }
DockerAssemblyManager { void verifyGivenDockerfile(File dockerFile, BuildConfiguration buildConfig, FixedStringSearchInterpolator interpolator, KitLogger log) throws IOException { AssemblyConfiguration assemblyConfig = buildConfig.getAssemblyConfiguration(); if (assemblyConfig == null) { return; } String name = assemblyConfig.getName(); for (String keyword : new String[] { "ADD", "COPY" }) { List<String[]> lines = InterPolatorHelper.extractLines(dockerFile, keyword, interpolator); for (String[] line : lines) { if (!line[0].startsWith("#")) { int i; for (i = 1; i < line.length; i++) { String component = line[i]; if (!component.startsWith("--")) { break; } } if (i < line.length && line[i].contains(name)) { return; } } } } log.warn("Dockerfile %s does not contain an ADD or COPY directive to include assembly created at %s. Ignoring assembly.", dockerFile.getPath(), name); } }
DockerAssemblyManager { void verifyGivenDockerfile(File dockerFile, BuildConfiguration buildConfig, FixedStringSearchInterpolator interpolator, KitLogger log) throws IOException { AssemblyConfiguration assemblyConfig = buildConfig.getAssemblyConfiguration(); if (assemblyConfig == null) { return; } String name = assemblyConfig.getName(); for (String keyword : new String[] { "ADD", "COPY" }) { List<String[]> lines = InterPolatorHelper.extractLines(dockerFile, keyword, interpolator); for (String[] line : lines) { if (!line[0].startsWith("#")) { int i; for (i = 1; i < line.length; i++) { String component = line[i]; if (!component.startsWith("--")) { break; } } if (i < line.length && line[i].contains(name)) { return; } } } } log.warn("Dockerfile %s does not contain an ADD or COPY directive to include assembly created at %s. Ignoring assembly.", dockerFile.getPath(), name); }  }
DockerAssemblyManager { void verifyGivenDockerfile(File dockerFile, BuildConfiguration buildConfig, FixedStringSearchInterpolator interpolator, KitLogger log) throws IOException { AssemblyConfiguration assemblyConfig = buildConfig.getAssemblyConfiguration(); if (assemblyConfig == null) { return; } String name = assemblyConfig.getName(); for (String keyword : new String[] { "ADD", "COPY" }) { List<String[]> lines = InterPolatorHelper.extractLines(dockerFile, keyword, interpolator); for (String[] line : lines) { if (!line[0].startsWith("#")) { int i; for (i = 1; i < line.length; i++) { String component = line[i]; if (!component.startsWith("--")) { break; } } if (i < line.length && line[i].contains(name)) { return; } } } } log.warn("Dockerfile %s does not contain an ADD or COPY directive to include assembly created at %s. Ignoring assembly.", dockerFile.getPath(), name); }  File createDockerTarArchive(String imageName, MavenBuildContext params, BuildConfiguration buildConfig, KitLogger log); File createDockerTarArchive(String imageName, final MavenBuildContext params, final BuildConfiguration buildConfig, KitLogger log, ArchiverCustomizer finalCustomizer); AssemblyFiles getAssemblyFiles(String name, BuildConfiguration buildConfig, MavenBuildContext mojoParams, KitLogger log); File createChangedFilesArchive(List<AssemblyFiles.Entry> entries, File assemblyDirectory,
                                          String imageName, MavenBuildContext mojoParameters); }
DockerAssemblyManager { void verifyGivenDockerfile(File dockerFile, BuildConfiguration buildConfig, FixedStringSearchInterpolator interpolator, KitLogger log) throws IOException { AssemblyConfiguration assemblyConfig = buildConfig.getAssemblyConfiguration(); if (assemblyConfig == null) { return; } String name = assemblyConfig.getName(); for (String keyword : new String[] { "ADD", "COPY" }) { List<String[]> lines = InterPolatorHelper.extractLines(dockerFile, keyword, interpolator); for (String[] line : lines) { if (!line[0].startsWith("#")) { int i; for (i = 1; i < line.length; i++) { String component = line[i]; if (!component.startsWith("--")) { break; } } if (i < line.length && line[i].contains(name)) { return; } } } } log.warn("Dockerfile %s does not contain an ADD or COPY directive to include assembly created at %s. Ignoring assembly.", dockerFile.getPath(), name); }  File createDockerTarArchive(String imageName, MavenBuildContext params, BuildConfiguration buildConfig, KitLogger log); File createDockerTarArchive(String imageName, final MavenBuildContext params, final BuildConfiguration buildConfig, KitLogger log, ArchiverCustomizer finalCustomizer); AssemblyFiles getAssemblyFiles(String name, BuildConfiguration buildConfig, MavenBuildContext mojoParams, KitLogger log); File createChangedFilesArchive(List<AssemblyFiles.Entry> entries, File assemblyDirectory,
                                          String imageName, MavenBuildContext mojoParameters); static final String DEFAULT_DATA_BASE_IMAGE; static final String SCRATCH_IMAGE; static final String DOCKER_IGNORE; static final String DOCKER_EXCLUDE; static final String DOCKER_INCLUDE; static final String DOCKERFILE_NAME; }