Skip to content

introproventures/helm-maven-plugin

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

What?

This is a Maven plugin for testing, packaging and uploading HELM charts.

"HELM is a tool for managing Kubernetes charts. Charts are packages of pre-configured Kubernetes resources."

Visit https://docs.helm.sh for detailed information.

Currently the upload to ChartMuseum and Artifactory is supported.

Maven Central

Build Status

Why?

Currently (October 2017) there is no simple Maven plugin to package existing HELM charts.

How?

The plugin downloads HELM in a specific version and runs the tool in the background.

Add following dependency to your pom.xml:

<dependency>
  <groupId>com.kiwigrid</groupId>
  <artifactId>helm-maven-plugin</artifactId>
  <version>2.6</version>
</dependency>

Configure plugin with explizit credentials:

...
<properties>
  <helm.download.url>https://storage.googleapis.com/kubernetes-helm/helm-v2.9.0-linux-amd64.tar.gz</helm.download.url>
  <repoBaseUrl>>https://repo.example.com/artifactory</repoBaseUrl>
</properties>
...
<build>
  <plugins>
  ...
    <plugin>
      <groupId>com.kiwigrid</groupId>
      <artifactId>helm-maven-plugin</artifactId>
      <version>2.6</version>
      <configuration>
        <chartDirectory>${project.basedir}</chartDirectory>
        <chartVersion>${project.version}</chartVersion>
        <uploadRepoStable>
            <name>stable-repo</name>
            <url>${repoBaseUrl}/helm-stable</url>
            <!-- Artifacotry requires basic authentication --> 
            <!-- which is supported from HELM version >= 2.9 -->
            <type>ARTIFACTORY</type>
            <username>foo</username>
            <password>bar</password>
        </uploadRepoStable>
        <uploadRepoSnapshot>
            <name>snapshot-repo</name>
            <url>${repoBaseUrl}/helm-snapshots</url>
            <type>CHARTMUSEUM</type>
        </uploadRepoSnapshot>
        <helmDownloadUrl>${helm.download.url}</helmDownloadUrl>
        <helmHomeDirectory>${project.basedir}/target/helm/home</helmHomeDirectory>
        <excludes>
          <exclude>${project.basedir}/excluded</exclude>
        </excludes>
        <helmExtraRepos>
          <helmRepo>
            <name>incubator</name>
            <url>https://kubernetes-charts-incubator.storage.googleapis.com</url>
          </helmRepo>
        </helmExtraRepos>
      </configuration>
    </plugin>
  ...
  </plugins>
</build>

Configure plugin using credentials from settings.xml:

...
<properties>
  <helm.download.url>https://storage.googleapis.com/kubernetes-helm/helm-v2.9.0-linux-amd64.tar.gz</helm.download.url>
  <repoBaseUrl>>https://repo.example.com/artifactory</repoBaseUrl>
</properties>
...
<build>
  <plugins>
  ...
    <plugin>
      <groupId>com.kiwigrid</groupId>
      <artifactId>helm-maven-plugin</artifactId>
      <version>2.6</version>
      <configuration>
        <chartDirectory>${project.basedir}</chartDirectory>
        <chartVersion>${project.version}</chartVersion>
        <uploadRepoStable>
            <name>stable-repo</name>
            <url>${repoBaseUrl}/helm-stable</url>
            <type>ARTIFACTORY</type>
        </uploadRepoStable>
        <uploadRepoSnapshot>
            <name>snapshot-repo</name>
            <url>${repoBaseUrl}/helm-snapshots</url>
            <type>CHARTMUSEUM</type>
        </uploadRepoSnapshot>
        <helmDownloadUrl>${helm.download.url}</helmDownloadUrl>
        <helmHomeDirectory>${project.basedir}/target/helm/home</helmHomeDirectory>
      </configuration>
    </plugin>
  ...
  </plugins>
</build>

Features

  • Package Helm charts from standard folder structure
  • Test Helm charts (Helm lint)
  • Recursive chart detection (subcharts)
  • Helm does not need to be installed
  • Upload to ChartMuseum or Artifactory
  • Repository names are interpreted as server ids to retrieve basic authentication from server list in settings.xml.

Usage

Goals

  • helm:init initializes Helm by downloading a specific version
  • helm:dependency-build resolves the chart dependencies
  • helm:package packages the given charts (chart.tar.gz)
  • helm:lint tests the given charts
  • helm:dry-run simulates an install
  • helm:upload upload charts via HTTP PUT

Configuration

  • <chartDirectory>

    • description: root directory of your charts
    • required: true
    • type: string
    • user property: helm.chartDirectory
  • <chartVersion>

    • description: Version of the charts. The version have to be in the SEMVER-Format, required by helm.
    • required: true
    • type: string
    • user property: helm.chartVersion
  • <helmDownloadUrl>

    • description: URL to download helm
    • required: false
    • type: string
    • user property: helm.downloadUrl
  • <excludes>

    • description: list of chart directories to exclude
    • required: false
    • type: list of strings
    • user property: helm.excludes
  • <helmExecutableDirectory>

    • description: directory of your helm installation
    • required: false
    • default value: ${project.build.directory}/helm
    • type: string
    • user property: helm.executableDirectory
  • <helmExecutable>

    • description: path to your helm executable
    • required: false
    • default value: "${project.build.directory}/helm/linux-amd64/helm
    • type: string
    • user property: helm.executable
  • <outputDirectory>

    • description: chart output directory
    • required: false
    • default value: ${project.build.directory}/helm/repo
    • type: string
    • user property: helm.outputDirectory
  • <helmHomeDirectory>

    • description: path to helm home directory; useful for concurrent Jenkins builds!
    • required: false
    • default value: ~/.helm
    • type: string
    • user property: helm.homeDirectory
  • <helmExtraRepos>

    • description: adds extra repositories while init
    • required: false
    • type: list of HelmRepository
    • user property: helm.extraRepos
  • <uploadRepoStable>

    • description: Upload repository for stable charts
    • required: true
    • type: HelmRepository
    • user property: helm.uploadRepo.stable
  • <uploadRepoSnapshot>

    • description: Upload repository for snapshot charts (determined by version postfix 'SNAPSHOT')
    • required: false
    • type: HelmRepository
    • user property: helm.uploadRepo.snapshot

About

Simple plugin to package helm charts

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 100.0%