Skip to content

Commit

Permalink
Merge pull request #77 from deviceinsight/feature/support-disabling-i…
Browse files Browse the repository at this point in the history
…ncubator

Allow to configure and disable the incubator repo
  • Loading branch information
pvorb authored Dec 17, 2020
2 parents 9752453 + f2238ef commit bcd84bc
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.adoc
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
= Changelog

== Version 2.8.0

* Support configuring the URL to the incubator repository via `incubatorRepoUrl` and allow to disable the incubator repository via `addIncubatorRepo`

== Version 2.7.1

* Fix inverted status check which _fails_ for any 2xx HTTP status
Expand Down
8 changes: 5 additions & 3 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ Add the following to your `pom.xml`
<plugin>
<groupId>com.deviceinsight.helm</groupId>
<artifactId>helm-maven-plugin</artifactId>
<version>2.1.0</version>
<version>2.7.1</version>
<configuration>
<chartName>my-chart</chartName>
<chartRepoUrl>https://kubernetes-charts.storage.googleapis.com/</chartRepoUrl>
<helmVersion>2.13.0</helmVersion>
<helmVersion>3.4.2</helmVersion>
<strictLint>true</strictLint>
<valuesFile>src/test/helm/my-chart/values.yaml</valuesFile>
</configuration>
Expand Down Expand Up @@ -79,7 +79,9 @@ that the correct docker image is used. An example snippet:

|chartName |The Maven `artifactId` |The name of the chart
|chartVersion |`${project.model.version}` |The version of the chart
|chartRepoUrl |`"https://kubernetes-helm.storage.googleapis.com/"` |The URL of the Chart repository where dependencies are required from and where charts should be published to
|chartRepoUrl |`null` |The URL of the Chart repository where dependencies are required from and where charts should be published to
|incubatorRepoUrl |`https://charts.helm.sh/incubator` |The URL to the incubator Chart repository
|addIncubatorRepo |`true` |Whether the repository defined in `incubatorRepoUrl` should be added when running the package goal
|chartPublishUrl |`${chartRepoUrl}/api/charts` |The URL that will be used for publishing the chart. The default value will work if `chartRepoUrl` refers to a ChartMuseum.
|chartPublishMethod |"POST" |The HTTP method that will be used for publishing requests
|chartDeleteUrl |`${chartRepoUrl}/api/charts/${chartName}/${chartVersion}` |The URL that will be used for deleting a previous version of the chart. This is used for updating SNAPSHOT versions. The default value will work if `chartRepoUrl` refers to a ChartMuseum.
Expand Down
12 changes: 9 additions & 3 deletions src/main/kotlin/com/deviceinsight/helm/PackageMojo.kt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import java.io.File
class PackageMojo : AbstractHelmMojo() {

companion object {
private val PLACEHOLDER_REGEX = Regex("""\$\{(.*?)\}""")
private val PLACEHOLDER_REGEX = Regex("""\$\{(.*?)}""")
private val SUBSTITUTED_EXTENSIONS = setOf("json", "tpl", "yml", "yaml")
}

Expand All @@ -45,7 +45,11 @@ class PackageMojo : AbstractHelmMojo() {
@Parameter(property = "chartRepoPassword", required = false)
private var chartRepoPassword: String? = null

private val incubatorRepository = "https://charts.helm.sh/incubator"
@Parameter(property = "incubatorRepoUrl", defaultValue = "https://charts.helm.sh/incubator")
private var incubatorRepoUrl: String = "https://charts.helm.sh/incubator"

@Parameter(property = "addIncubatorRepo", defaultValue = "true")
private var addIncubatorRepo: Boolean = true

@Throws(MojoExecutionException::class)
override fun execute() {
Expand Down Expand Up @@ -79,7 +83,9 @@ class PackageMojo : AbstractHelmMojo() {
executeCmd("$helm init --client-only")
}

executeCmd("$helm repo add incubator $incubatorRepository")
if (addIncubatorRepo) {
executeCmd("$helm repo add incubator $incubatorRepoUrl")
}
if (chartRepoUrl != null) {
val authParams = if (chartRepoUsername != null && chartRepoPassword != null) {
" --username $chartRepoUsername --password $chartRepoPassword"
Expand Down

0 comments on commit bcd84bc

Please sign in to comment.