Skip to content

Clean goal deletes charts subfolders whole content #398

@Rayzen

Description

@Rayzen

When executing clean goal all contents under charts folder is deleted, including local subcharts

@Override
public void execute() throws MojoExecutionException {

	if (skip || skipClean) {
		getLog().info("Skip clean");
		return;
	}

	for (Path chartDirectory : getChartDirectories()) {
		getLog().info("Cleanups chart " + chartDirectory + "...");
		Path chartsPath = chartDirectory.resolve("charts");
		if (Files.exists(chartsPath)) {
			try {
				try (Stream<Path> paths = Files.walk(chartsPath)) {
					paths.sorted(Comparator.reverseOrder()).forEach(this::delete);
				}
				delete(chartDirectory.resolve("Chart.lock"));
			} catch (IOException e) {
				throw new MojoExecutionException("Failed to cleanups chart " + chartDirectory, e);
			}
		}
	}
}

I think the right behaviour should be deleteing only .lock files (Chart.lock and requirements.lock) and .tgz files only.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions