Skip to content

Commit

Permalink
Allow to write URL of the uploaded chart into a specific file
Browse files Browse the repository at this point in the history
  • Loading branch information
Vincent MIJOULE committed Apr 9, 2024
1 parent 2232fb9 commit 3d4e3f0
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,7 @@ Parameter | Type | User Property | Required | Description
`<overwriteLocalDependencies>` | boolean | helm.overwriteLocalDependencies | false | Controls whether a local path chart should be used for a chart dependency. When set to `true`, chart dependencies on a local path chart will be overwritten with the respective properties set by `overwriteDependencyVersion` and `overwriteDependencyRepository`. This is helpful for deploying charts with intra repository dependencies, while still being able to use local path dependencies for development builds. Example usage: for development use `mvn clean install` and for deployment use `mvn clean deploy -Dhelm.overwriteLocalDependencies=true`
`<overwriteDependencyVersion>` | string | helm.overwriteDependencyVersion | false | Value used to overwrite a local path chart's version within a chart's dependencies. The property `overwriteLocalDependencies` must be set to `true` for this to apply.
`<overwriteDependencyRepository>` | string | helm.overwriteDependencyRepository | false | Value used to overwrite a local path chart's repository within a chart's dependencies. The property `overwriteLocalDependencies` must be set to `true` for this to apply.
`<helmChartUploadUrlFile>` | string | helm.upload.urlWriteFile | false | File to wrie the URL of the uploaded chart

## Packaging with the Helm Lifecycle

Expand Down
17 changes: 17 additions & 0 deletions src/main/java/io/kokuwa/maven/helm/UploadMojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,14 @@ public class UploadMojo extends AbstractHelmMojo {
@Parameter(property = "helm.upload.timeout", defaultValue = "30")
private Integer uploadVerificationTimeout;

/**
* File where to write the helm chart upload URL.
*
* @since 6.14.0
*/
@Parameter(property = "helm.upload.urlWriteFile")
private File helmChartUploadUrlFile;

@Override
public void execute() throws MojoExecutionException {

Expand Down Expand Up @@ -159,6 +167,15 @@ public void execute() throws MojoExecutionException {
}
}
}

if (helmChartUploadUrlFile != null) {
try {
getLog().info("Writing helm chart upload URL to file: " + helmChartUploadUrlFile);
Files.write(helmChartUploadUrlFile.toPath(), getHelmUploadUrl().getBytes(StandardCharsets.UTF_8));
} catch (IOException e) {
throw new MojoExecutionException("Failed to write helm chart upload URL to file", e);
}
}
}

/**
Expand Down

0 comments on commit 3d4e3f0

Please sign in to comment.