unbroken-dome / gradle-helm-plugin

A Gradle plugin for building, publishing and managing Helm charts.
MIT License
52 stars 55 forks source link

Setting the Helm client download via the DSL #137

Open bmuschko opened 2 years ago

bmuschko commented 2 years ago

At this time, the plugin scans the project property helm.client.download.baseUrl to provide a custom download URL. In my use case, the plugin is bundled with an internal, company-wide plugin which should point your plugin to a custom download URL. AFAIK, a plugin cannot set a project property from code or bundle a gradle.properties. There needs to be another way to set the property via the plugin DSL.

tkrullmann commented 2 years ago

Hi,

did you try to set the project property via ext / extra?

extra.set("helm.client.download.baseUrl", "https://custom.get.helm.sh")

I think it should be fine to set this the build script, even after applying the plugin, because the plugin uses lazy providers for all the project properties, so it won't be evaluated until the download is actually performed.

As a note, I just had to change how the download works, because the current behavior was conflicting with Gradle's dependencyResolutionManagement feature, instead of adding a custom artifact repository it now installs a task on the root project that does the download using plain-old HttpURLConnection. It's on the root project so all the subprojects can sync on the download and don't do multiple downloads in parallel.

This means that the helm.client.download.baseUrl property must be set on the root project, and different subprojects cannot use a different base URL (but that shouldn't be a problem in your case)

bmuschko commented 2 years ago

Gradle properties are a different concept than extra properties so I doubt this will work. You can only set Gradle properties by adding it to gradle.properties or by providing them with -P on the command line.

I tried it out with the following build script and it doesn't work.

plugins {
    id 'org.unbroken-dome.helm' version '1.6.1'
}

helm {
    downloadClient {
        enabled = true
        version = '3.4.0'
    }
}

ext.set('helm.client.download.baseUrl', 'https://custom.get.helm.sh')

Why don't we introduce a new property to helm.downloadClient? For example:

helm {
    downloadClient {
        baseUrl = 'https://custom.get.helm.sh'
    }
}
bmuschko commented 2 years ago

Could you please comment on this? Happy to provide a pull request if that's the way to go.

bmuschko commented 2 years ago

Ping!

vojtechvit commented 2 years ago

Hey folks, can we merge this one please? It's an important one for us

dswiecki commented 1 year ago

It looks as if https://get.helm.sh/ is no longer available