Simple Gradle plugin to wrap Helm executable as tasks.
By using this plugin there is no need to download and install helm client. Helm executable is downloaded and unpacked to specific local directory. All major operating systems such as Linux, Windows, Mac OS are supported.
- JDK 8 or higher and
JAVA_HOME
properly set to run gradle wrapper - configured Kubernetes context to be used by helm client
- Apply a plugin to a project as described on gradle portal.
- Configure a plugin by specifying desired helm version in build script.
All versions can be checked HERE.
helmPlugin { helmVersion.set("3.16.1") }
- Define a task to run desired helm client command, for example:
tasks { register<HelmTask>("helmHelp") { args("--help") } }
- Run helm command from gradle:
# Linux ./gradlew helmHelp # Windows gradlew.bat helmHelp
Plugin behavior can be adjusted by the following properties:
helmVersion
- version of Helm to download,3.16.1
by defaulthelmSetupDir
- installation directory, by default:<project_dir>/.gradle/helmClient-v<helmVersion>
operatingSystem
- local operating system,linux
by defaultarchitecture
- system CPU architecture, resolved byos.arch
system property by defaulthelmPackage
- name of the package to download and save as, by defaulthelm-v${helmVersion.get()}-${operatingSystem.get()}-${architecture.get()}.tar.gz
helmDownloadUrl
- can be used to adjust the download URL directly, e.g.https://releases.hashicorp.com/helm/1.9.6/helm_1.9.6_linux_arm64.zip
, by default it is resolved ashttps://releases.hashicorp.com/helm/${helmVersion.get()}/${helmPackage.get()}
helmExec
- executable location,<helmSetupDir>/${operatingSystem.get()}-${architecture.get()}/helm")
Sample configuration block can look like:
helmPlugin {
helmVersion = "4.10.0-alpha"
helmSetupDir = File("setupDir")
operatingSystem = "Linux"
architecture = "arm64"
helmPackage = "customHelm.zip"
helmDownloadUrl = "https://proxy-helm/helm.zip"
helmExec = File("setupDir").resolve("helm")
}