-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add releaseName handling for install, uninstall and upgrade, fix #350
- Loading branch information
Showing
8 changed files
with
133 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
src/main/java/io/kokuwa/maven/helm/AbstractHandleMojo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package io.kokuwa.maven.helm; | ||
|
||
import java.nio.file.Path; | ||
import java.util.List; | ||
import java.util.stream.Collectors; | ||
|
||
import org.apache.maven.plugin.MojoExecutionException; | ||
import org.apache.maven.plugins.annotations.Parameter; | ||
|
||
import lombok.Setter; | ||
import lombok.Value; | ||
|
||
/** Base class for dependency build and update mojos. */ | ||
@Setter | ||
public abstract class AbstractHandleMojo extends AbstractHelmWithValueOverrideMojo { | ||
|
||
/** | ||
* Name of the release to handle. | ||
* | ||
* @since 6.4.0 | ||
*/ | ||
@Parameter(property = "helm.releaseName") | ||
private String releaseName; | ||
|
||
List<Chart> getCharts() throws MojoExecutionException { | ||
|
||
List<Path> chartDirectories = getChartDirectories(); | ||
if (releaseName != null && chartDirectories.size() > 1) { | ||
throw new MojoExecutionException("For multiple charts releaseName is not supported."); | ||
} | ||
|
||
return chartDirectories.stream() | ||
.map(p -> new Chart(releaseName == null ? p.getFileName().toString() : releaseName, p)) | ||
.collect(Collectors.toList()); | ||
} | ||
|
||
@Value | ||
class Chart { | ||
private final String releaseName; | ||
private final Path directory; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters