melahn / helm-chartmap-generator

A tool for generating ChartMap dependency reports
MIT License
0 stars 0 forks source link
helm helm-chartmap-generator kubernetes plantuml

helm-chartmap-generator

GitHub last commit GitHub Build Status GitHub release (latest by date) GitHub Release Date Maven Central License Sonar Cloud Quality Gate Status Coverage

Overview

This project generates a set of helm dependency reports in various formats for a given helm chart repository. It uses the ChartMap project to generate the reports.

The generated reports can be in various formats including

In addition to producing the dependency report files, an 'index.html' file is produced that lists the files and provided links to view them.

You can see lots of examples here -> (https://melahn.github.io/helm-chartmap-generator/)

Dependency Info

Available from the Maven Central Repository.

<dependency>
  <groupId>com.melahn</groupId>
  <artifactId>helm-chartmap-generator</artifactId>
  <version>1.0.2</version>
</dependency>

Prerequisites

Usage

  1. Download the stable release from Maven Central or build the latest yourself from source (see below).

  2. Run the command line. See Syntax and Examples below.

Command Line Syntax

java -jar helm-chartmap-generator-1.1.0-SNAPSHOT.jar

Flags:
   -r <repo name>  
   -o <directory name>  
   -f <file format mask> 
   -n <integer>  
   -e <file name> 
   -v verbose   
   -h help 

Flags

Example Commands

Generating reports from the incubator repo using all the detaults
    java -helm-chartmap-generator-1.1.0-SNAPSHOT.jar -r incubator 
Generating JSON and PlantUML reports from the stable repo, with up to 3 versions printed with verbose output
    java -helm-chartmap-generator-1.1.0-SNAPSHOT.jar -r stable -f pj -n 3 -v 

Note: Since PlantUML reports are generated in this example, corresonding image files will also be produced.

Java Methods

In addition to the command line interface, a Java API is provided.

Constructor

    public ChartMapGenerator(String repoName,
                    String outputDirName,
                    String fileFormatMask,
                    int maxVersions,
                    String envSpecFilename,
                    boolean verbose)     
Description of ChartMap constructor

Constructs a new instance of the com.melahn.util.helm.ChartMapGenerator class

Parameters
Throws

generate

Description of print command

Generates a set of ChartMaps for the helm repo.


    public void generate ()
Throws in generate command

Java Example

import com.melahn.util.helm.ChartMapGenerator;
import com.melahn.util.helm.ChartMapGeneratorException;

public class ChartMapGeneratorExample {
    public static void generateExampleChartMap(String[] args) {
        try {
            ChartMap testMapGenerator = new ChartMapGenerator(
                    "bitnami",
                    "target/test",
                    "pt",
                    "resource/example/example-env-spec.yaml",
                    2,
                    false);
            testMap.generate();
        } catch (ChartMapGeneratorException e) {
            System.out.println("ChartMapGeneratorException generating chart maps: ".concat(e.getMessage()));
        }
    }
}

More examples illustrating the use of the Java interface can be found in ChartMapGeneratorTest.java.

PlantUML Notes

When generating PlantUML files, the images that are then produced from those files will have the best layout when the following system environment variable is set before running helm-chart-generator.

PLANTUML_LIMIT_SIZE 8192

Build Notes

Maven Commands

Building the jar from source and running tests

  1. git clone this repository
  2. run maven
mvn clean install 

Note: The jar targets Java 8 for the widest compatibility. You can target a different version of Java by modifying the configuration in the maven-compiler-plugin to use a different target like in the example below.

<target>11</target>

Build Warnings

When the shaded jar is built by the maven-shade-plugin there is a warning produced like this...

     target/classes (Is a directory)

This warning is due to a long-standing issue where the shade plugin checks if a classpath element is a jar, and if it is not, swallows useful error information. It instead prints out this meaningless warning. See https://issues.apache.org/jira/browse/MSHADE-376 for more details. See https://github.com/melahn/maven-shade-plugin if you want to install your own version of the plugin, with a fix that eliminates this warning.

Issues

If you find any problems please open an issue.

License

MIT