Skip to content

Commit

Permalink
Add flags for --name-template, fix #376 (#381)
Browse files Browse the repository at this point in the history
  • Loading branch information
sschnabe authored Sep 10, 2024
1 parent d1c35ad commit 1eac886
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,7 @@ Parameter | Type | User Property | Required | Description
`<uninstallKeepHistory>` | boolean | helm.uninstall.keep-history | false | Remove all associated resources and mark the release as deleted, but retain the release history.
`<uninstallIgnoreNotFound>` | boolean | helm.uninstall.ignore-not-found | false | Treat "release not found" as a successful uninstall.
`<templateOutputDir>` | file | helm.template.output-dir | false | Writes the executed templates to files in output-dir instead of stdout.
`<templateTemplateName>` | string | helm.template.name-template | false | Specify template used to name the release.
`<templateGenerateName>` | boolean | helm.template.generate-name | false | Generate the name (and omit the NAME parameter).
`<templatePlainHttp>` | boolean | helm.template.plain-http | false | Use insecure HTTP connections for the chart download.
`<pushPlainHttp>` | boolean | helm.push.plain-http | false | Use insecure HTTP connections for the chart download.
Expand Down
9 changes: 9 additions & 0 deletions src/main/java/io/kokuwa/maven/helm/TemplateMojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,14 @@ public class TemplateMojo extends AbstractHelmWithValueOverrideMojo {
@Parameter(property = "action", defaultValue = "template")
private String action;

/**
* Specify template used to name the release.
*
* @since 6.15
*/
@Parameter(property = "helm.template.name-template")
private String templateNameTemplate;

/**
* Writes the executed templates to files in output-dir instead of stdout.
*
Expand Down Expand Up @@ -89,6 +97,7 @@ public void execute() throws MojoExecutionException, MojoFailureException {
.arguments(action, chartDirectory)
.arguments(getArguments())
.flag("output-dir", templateOutputDir)
.flag("name-template", templateNameTemplate)
.flag("generate-name", templateGenerateName)
.flag("plain-http", isPlainHttp(templatePlainHttp))
.execute("There are test failures");
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/io/kokuwa/maven/helm/github/Github.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import lombok.RequiredArgsConstructor;

/**
* Utility for Github requests with cachging.
* Utility for Github requests with caching.
*
* @author Stephan Schnabel
* @since 6.1.0
Expand Down
8 changes: 8 additions & 0 deletions src/test/java/io/kokuwa/maven/helm/TemplateMojoTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,14 @@ void additionalArguments(TemplateMojo mojo) {
assertHelm(mojo, "template src/test/resources/simple --foo --bar");
}

@DisplayName("with --name-template")
@Test
void nameTemplate(TemplateMojo mojo) {
mojo.setSkipTemplate(false);
mojo.setTemplateNameTemplate("my-name");
assertHelm(mojo, "template src/test/resources/simple --name-template my-name");
}

@DisplayName("with --output-dir")
@Test
void outputDirectory(TemplateMojo mojo) {
Expand Down

0 comments on commit 1eac886

Please sign in to comment.